Skip to content
Myr

fix: jump state (#590)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by M. Bagher Abiat · committed by GitHub · parent e9a8eaa · Browse files · 1 file+8 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−3 removed

  • other:+8 added−3 removed

1 file+8 added−3 removed

modified:src/middleware.ts+8 added-3 removed
110 unmodified lines
111 ) => {112 const newState = api.getState()113 if (state !== newState) {114 savedSetState(state, replace)115 if (state !== (newState as any)[DEVTOOLS]) {115 api.devtools.send(api.devtools.prefix + 'setState', api.getState())116 api.devtools.send(api.devtools.prefix + 'setState', api.getState())117 }118 }119 }120 options = typeof options === 'string' ? { name: options } : options121 api.devtools = extension.connect({ ...options })122 api.devtools.prefix = options?.name ? `${options.name} > ` : ''123 api.devtools.subscribe((message: any) => {124 if (message.type === 'DISPATCH' && message.state) {123 const ignoreState =125 const jumpState =126 message.payload.type === 'JUMP_TO_ACTION' ||127 message.payload.type === 'JUMP_TO_STATE'128 const newState = api.getState()129 ;(newState as any)[DEVTOOLS] = JSON.parse(message.state)130128 if (!api.dispatch && !ignoreState) {131 if (!api.dispatch && !jumpState) {132 api.setState(newState)133 } else if (jumpState) {134 api.setState((newState as any)[DEVTOOLS])135 } else {136 savedSetState(newState)137 }138 } else if (
313 unmodified lines