MCPcopy
hub / github.com/zalmoxisus/remote-redux-devtools

github.com/zalmoxisus/remote-redux-devtools @v0.5.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.5.0 ↗
157 symbols 392 edges 85 files 0 documented · 0%
README

Remote Redux DevTools

Demo

Use Redux DevTools remotely for React Native, hybrid, desktop and server side Redux apps.

Installation

npm install --save-dev remote-redux-devtools

Usage

There are 2 ways of usage depending if you're using other store enhancers (middlewares) or not.

Add DevTools enhancer to your store

If you have a basic store as described in the official redux-docs, simply replace: javascript import { createStore } from 'redux'; const store = createStore(reducer); with javascript import { createStore } from 'redux'; import devToolsEnhancer from 'remote-redux-devtools'; const store = createStore(reducer, devToolsEnhancer()); // or const store = createStore(reducer, preloadedState, devToolsEnhancer());

Note: passing enhancer as last argument requires redux@>=3.1.0

Use DevTools compose helper

If you setup your store with middleware and enhancers, change this: ```javascript import { createStore, applyMiddleware, compose } from 'redux';

const store = createStore(reducer, preloadedState, compose( applyMiddleware(...middleware), // other store enhancers if any )); to:javascript import { createStore, applyMiddleware } from 'redux'; import { composeWithDevTools } from 'remote-redux-devtools';

const store = composeWithDevTools(reducer, / preloadedState, / composeWithDevTools( applyMiddleware(...middleware), // other store enhancers if any )); or with devTools' options:javascript import { createStore, applyMiddleware } from 'redux'; import { composeWithDevTools } from 'remote-redux-devtools';

const composeEnhancers = composeWithDevTools({ realtime: true, port: 8000 }); const store = composeWithDevTools(reducer, / preloadedState, / composeEnhancers( applyMiddleware(...middleware), // other store enhancers if any )); ```

Important

In order not to allow it in production by default, the enhancer will have effect only when process.env.NODE_ENV === 'development'. In case you don't set NODE_ENV or want to use it in production, set realtime parameter to true:

js const store = createStore(reducer, devToolsEnhancer({ realtime: true }));

Monitoring

Use one of our monitor apps to inspect and dispatch actions: * web * redux-devtools-extension - Click "Remote" button (or press Cmd+Ctrl+Arrow up) to open remote monitoring. * react-native-debugger - Electron app, which already includes remotedev-server, remotedev-app and even React DevTools. * chrome app. * remote-redux-devtools-on-debugger - Used in React Native debugger as a dock monitor. * atom-redux-devtools - Used in Atom editor. * redux-dispatch-cli - A CLI tool for Redux remote dispatch.

Use remotedev-app to create your own monitor app.

Communicate via local server

In order to make it simple to use, by default, the module and the monitor app communicate via remotedev.io server. Use remotedev-server cli to run it locally in order to make the connection faster and not to require an internet connection. You can import it in your server.js script and start remotedev server together with your development server:

var remotedev = require('remotedev-server');
remotedev({ hostname: 'localhost', port: 8000 });

See remotedev-server repository for more details. For React Native you can use react-native-debugger or remote-redux-devtools-on-debugger, which already include remotedev-server.

Parameters

Name Description
name String representing the instance name to be shown on the remote monitor.
realtime Boolean specifies whether to allow remote monitoring. By default is process.env.NODE_ENV === 'development'.
hostname String used to specify host for remotedev-server. If port is specified, default value is localhost.
port Number used to specify host's port for remotedev-server.
secure Boolean specifies whether to use https protocol for remotedev-server.
maxAge Number of maximum allowed actions to be stored on the history tree, the oldest actions are removed once maxAge is reached. Default is 30.
filters Map of arrays named whitelist or blacklist to filter action types. See the example bellow.
actionSanitizer Function which takes action object and id number as arguments, and should return action object back. See the example bellow.
stateSanitizer Function which takes state object and index as arguments, and should return state object back. See the example bellow.
startOn String or Array of strings indicating an action or a list of actions, which should start remote monitoring (when realtime is false).
stopOn String or Array of strings indicating an action or a list of actions, which should stop remote monitoring.
sendOn String or Array of strings indicating an action or a list of actions, which should trigger sending the history to the monitor (without starting it). Note: when using it, add a fetch polyfill if needed.
sendOnError Numeric code: 0 - disabled (default), 1 - send all uncaught exception messages, 2 - send only reducers error messages.
sendTo String url of the monitor to send the history when sendOn is triggered. By default is ${secure ? 'https' : 'http'}://${hostname}:${port}.
actionCreators Array or Object of action creators to dispatch remotely. See the example.
shouldHotReload Boolean - if set to false, will not recompute the states on hot reloading (or on replacing the reducers). Default to true.
shouldRecordChanges Boolean - if specified as false, it will not record the changes till clicked on "Start recording" button on the monitor app. Default is true.
shouldStartLocked Boolean - if specified as true, it will not allow any non-monitor actions to be dispatched till lockChanges(false) is dispatched. Default is false.
id String to identify the instance when sending the history triggered by sendOn. You can use, for example, user id here, to know who sent the data.

All parameters are optional. You have to provide at least port property to use localhost instead of remotedev.io server.

Example:

export default function configureStore(preloadedState) {
  const store = createStore(
    reducer,
    preloadedState,
    devToolsEnhancer({
      name: 'Android app', realtime: true,
      hostname: 'localhost', port: 8000,
      maxAge: 30, filters: { blacklist: ['EFFECT_RESOLVED'] },
      actionSanitizer: (action) => (
       action.type === 'FILE_DOWNLOAD_SUCCESS' && action.data ?
       { ...action, data: '<<LONG_BLOB>>' } : action
      ),
      stateSanitizer: (state) => state.data ? { ...state, data: '<<LONG_BLOB>>' } : state
    })
  );
  return store;
}

Demo

Examples

License

MIT

Core symbols most depended-on inside this repo

todos
called by 10
examples/todomvc/reducers/todos.js
todos
called by 10
examples/router/reducers/todos.js
relay
called by 8
src/devTools.js
async
called by 5
src/devTools.js
render
called by 5
examples/todomvc/containers/App.js
render
called by 5
examples/router/containers/App.js
compose
called by 4
src/devTools.js
counter
called by 4
examples/counter/reducers/counter.js

Shape

Function 100
Method 29
Class 28

Languages

TypeScript100%

Modules by API surface

src/devTools.js19 symbols
examples/todomvc/components/TodoTextInput.js7 symbols
examples/router/components/TodoTextInput.js7 symbols
examples/todomvc/components/TodoItem.js6 symbols
examples/todomvc/components/MainSection.js6 symbols
examples/todomvc/actions/todos.js6 symbols
examples/router/components/TodoItem.js6 symbols
examples/router/components/MainSection.js6 symbols
examples/router/actions/todos.js6 symbols
examples/todomvc/containers/App.js5 symbols
examples/router/containers/App.js5 symbols
examples/toggle-monitoring/test/actions/counter.spec.js4 symbols

Dependencies from manifests, versioned

babel-cli6.3.15 · 1×
babel-core6.1.20 · 1×
babel-eslint5.0.0-beta6 · 1×
babel-loader6.2.0 · 1×
babel-plugin-react-transform2.0.0-beta1 · 1×
babel-plugin-transform-decorators-legacy1.2.0 · 1×
babel-polyfill6.3.14 · 1×
babel-preset-es20156.3.13 · 1×
babel-preset-es2015-loose6.1.3 · 1×
babel-preset-react6.3.13 · 1×
babel-preset-stage-06.3.13 · 1×
classnames2.1.2 · 1×

For agents

$ claude mcp add remote-redux-devtools \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact