@@ -7,20 +7,22 @@ import {
77 generateId ,
88 stringify ,
99 getSeralizeParameter ,
10- } from 'remotedev- utils' ;
11- import importState from 'remotedev-utils /lib/importState' ;
10+ } from 'redux-devtools-core/lib/ utils' ;
11+ import importState from 'redux-devtools-core /lib/utils /importState' ;
1212import {
1313 getLocalFilter ,
1414 isFiltered ,
1515 filterStagedActions ,
1616 filterState ,
17- } from 'remotedev-utils /lib/filters' ;
17+ } from 'redux-devtools-core /lib/utils /filters' ;
1818
1919function configureStore ( next , subscriber , options ) {
2020 return instrument ( subscriber , options ) ( next ) ;
2121}
2222
23- const instances = { /* [id]: { name, store, ... } */ } ;
23+ const instances = {
24+ /* [id]: { name, store, ... } */
25+ } ;
2426
2527let lastAction ;
2628let isExcess ;
@@ -34,9 +36,12 @@ function getLiftedState(store, filters) {
3436
3537function relay ( type , state , instance , action , nextActionId ) {
3638 const {
37- filters, predicate,
38- stateSanitizer, actionSanitizer,
39- serializeState, serializeAction,
39+ filters,
40+ predicate,
41+ stateSanitizer,
42+ actionSanitizer,
43+ serializeState,
44+ serializeAction,
4045 } = instance ;
4146
4247 const message = {
@@ -45,12 +50,21 @@ function relay(type, state, instance, action, nextActionId) {
4550 name : instance . name ,
4651 } ;
4752 if ( state ) {
48- message . payload = type === 'ERROR' ?
49- state :
50- stringify (
51- filterState ( state , type , filters , stateSanitizer , actionSanitizer , nextActionId , predicate ) ,
52- serializeState
53- ) ;
53+ message . payload =
54+ type === 'ERROR'
55+ ? state
56+ : stringify (
57+ filterState (
58+ state ,
59+ type ,
60+ filters ,
61+ stateSanitizer ,
62+ actionSanitizer ,
63+ nextActionId ,
64+ predicate
65+ ) ,
66+ serializeState
67+ ) ;
5468 }
5569 if ( type === 'ACTION' ) {
5670 message . action = stringify (
@@ -103,9 +117,9 @@ function exportState({ id: instanceId, store, serializeState }) {
103117 type : 'EXPORT' ,
104118 payload : stringify ( payload , serializeState ) ,
105119 committedState :
106- typeof liftedState . committedState !== 'undefined' ?
107- stringify ( liftedState . committedState , serializeState ) :
108- undefined ,
120+ typeof liftedState . committedState !== 'undefined'
121+ ? stringify ( liftedState . committedState , serializeState )
122+ : undefined ,
109123 instanceId,
110124 } ,
111125 } ) ;
@@ -228,16 +242,14 @@ export default function devToolsEnhancer(options = {}) {
228242 const serializeAction = getSeralizeParameter ( options , 'serializeAction' ) ;
229243
230244 return next => ( reducer , initialState ) => {
231- const store = configureStore (
232- next , monitorReducer , {
233- maxAge,
234- shouldCatchErrors,
235- shouldHotReload,
236- shouldRecordChanges,
237- shouldStartLocked,
238- pauseActionType,
239- }
240- ) ( reducer , initialState ) ;
245+ const store = configureStore ( next , monitorReducer , {
246+ maxAge,
247+ shouldCatchErrors,
248+ shouldHotReload,
249+ shouldRecordChanges,
250+ shouldStartLocked,
251+ pauseActionType,
252+ } ) ( reducer , initialState ) ;
241253
242254 instances [ id ] = {
243255 name : name || id ,
@@ -266,20 +278,17 @@ export default function devToolsEnhancer(options = {}) {
266278 } ;
267279}
268280
269- const preEnhancer = instanceId => next =>
270- ( reducer , initialState , enhancer ) => {
271- const store = next ( reducer , initialState , enhancer ) ;
281+ const preEnhancer = instanceId => next => ( reducer , initialState , enhancer ) => {
282+ const store = next ( reducer , initialState , enhancer ) ;
272283
273- if ( instances [ instanceId ] ) {
274- instances [ instanceId ] . store = store ;
275- }
276- return {
277- ...store ,
278- dispatch : ( action ) => (
279- locked ? action : store . dispatch ( action )
280- ) ,
281- } ;
284+ if ( instances [ instanceId ] ) {
285+ instances [ instanceId ] . store = store ;
286+ }
287+ return {
288+ ...store ,
289+ dispatch : action => ( locked ? action : store . dispatch ( action ) ) ,
282290 } ;
291+ } ;
283292
284293devToolsEnhancer . updateStore = ( newStore , instanceId ) => {
285294 console . warn (
@@ -309,7 +318,8 @@ devToolsEnhancer.updateStore = (newStore, instanceId) => {
309318const compose = options => ( ...funcs ) => ( ...args ) => {
310319 const instanceId = generateId ( options . instanceId ) ;
311320 return [ preEnhancer ( instanceId ) , ...funcs ] . reduceRight (
312- ( composed , f ) => f ( composed ) , devToolsEnhancer ( { ...options , instanceId } ) ( ...args )
321+ ( composed , f ) => f ( composed ) ,
322+ devToolsEnhancer ( { ...options , instanceId } ) ( ...args )
313323 ) ;
314324} ;
315325
0 commit comments