refactor(examples): add rtk-query-polling to workspace

Other changes:

* docs(rtk-query-polling): add README.md
This commit is contained in:
FaberVitale 2021-06-14 18:07:08 +02:00
parent 6924ed078c
commit 20f4f5432e
7 changed files with 3450 additions and 12040 deletions

View File

@ -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": {

View File

@ -1 +1,4 @@
SKIP_PREFLIGHT_CHECK=true
REACT_APP_REMOTE_DEV_TOOLS_PORT=8000
REACT_APP_REMOTE_DEV_TOOLS_HOST=localhost
PORT=3002

View 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`.

View File

@ -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": {

View File

@ -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

3952
yarn.lock

File diff suppressed because it is too large Load Diff