mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
refactor(examples): add rtk-query-polling to workspace
Other changes: * docs(rtk-query-polling): add README.md
This commit is contained in:
parent
6924ed078c
commit
20f4f5432e
|
@ -69,6 +69,7 @@
|
|||
"packages/react-json-tree/examples",
|
||||
"packages/redux-devtools/examples/counter",
|
||||
"packages/redux-devtools/examples/todomvc",
|
||||
"packages/redux-devtools/examples/rtk-query-polling",
|
||||
"packages/redux-devtools-slider-monitor/examples/todomvc"
|
||||
],
|
||||
"engines": {
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
SKIP_PREFLIGHT_CHECK=true
|
||||
REACT_APP_REMOTE_DEV_TOOLS_PORT=8000
|
||||
REACT_APP_REMOTE_DEV_TOOLS_HOST=localhost
|
||||
PORT=3002
|
17
packages/redux-devtools/examples/rtk-query-polling/README.md
Normal file
17
packages/redux-devtools/examples/rtk-query-polling/README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# rtk-query polling example
|
||||
|
||||
## Description
|
||||
|
||||
A copy of https://github.com/reduxjs/redux-toolkit/tree/master/examples/query/react/polling that
|
||||
adds a connection via `remote-redux-devtools` to a devtools server.
|
||||
|
||||
## Run example
|
||||
|
||||
```bash
|
||||
yarn lerna run --parallel start \
|
||||
--scope 'rtk-query-polling' \
|
||||
--scope '@redux-devtools/app' \
|
||||
--scope '@redux-devtools/cli'
|
||||
```
|
||||
|
||||
Runs the example at `localhost:3002`, `app` at `localhost:3000` and remote server at `8000`.
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "rtk-query-example-polling",
|
||||
"name": "rtk-query-polling",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "",
|
||||
"description": "A redux app powered by rtk-query connected via remote-redux-devtools",
|
||||
"keywords": [],
|
||||
"main": "src/index.tsx",
|
||||
"dependencies": {
|
||||
|
|
|
@ -2,6 +2,8 @@ import { configureStore } from '@reduxjs/toolkit'
|
|||
import { pokemonApi } from './services/pokemon'
|
||||
import devToolsEnhancer from 'remote-redux-devtools';
|
||||
|
||||
const remotePort = Number(process.env.REACT_APP_REMOTE_DEV_TOOLS_PORT) ?? 8000;
|
||||
const remoteHostname = process.env.REACT_APP_REMOTE_DEV_TOOLS_HOST ?? 'localhost';
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
|
@ -11,5 +13,5 @@ export const store = configureStore({
|
|||
// adding the api middleware enables caching, invalidation, polling and other features of `rtk-query`
|
||||
middleware: (getDefaultMiddleware) =>
|
||||
getDefaultMiddleware().concat(pokemonApi.middleware),
|
||||
enhancers : [devToolsEnhancer({ port: 8000, hostname: 'localhost' })]
|
||||
enhancers : [devToolsEnhancer({ port: remotePort, hostname: remoteHostname })]
|
||||
})
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user