Skip to content

Commit

Permalink
fix(devtools): fixed event hook
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcourtice committed Aug 5, 2021
1 parent cd268a4 commit 8796aef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/devtools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ function getStoreSnapshot(store: InternalStore): CustomInspectorState {
return Object.entries(store.registrations).reduce((output, [type, registrations]) => {
output[type] = Array.from(registrations)
.sort(([a], [b]) => stringComparitor(a, b))
.map(([key, producer]) => ({
.map(([key, { type, producer }]) => ({
key,
value: producer(),
editable: false,
objectType: 'other',
objectType: type,
} as StateBase));

return output;
Expand Down Expand Up @@ -218,7 +218,7 @@ export default function createDevtoolsPlugin(options: Partial<Options> = OPTIONS
} as PluginDescriptor;

setupDevtoolsPlugin(descriptor, api => {
const afterMutationHook = getMutationHook(api);
const successMutationHook = getMutationHook(api);
const errorMutationHook = getMutationHook(api, 'error');

api.addInspector({
Expand All @@ -239,7 +239,7 @@ export default function createDevtoolsPlugin(options: Partial<Options> = OPTIONS
api.on.getInspectorState(inspectorStateHook);
api.on.editInspectorState(inspectorEditHook);

eventEmitter.on(EVENTS.mutation.after, afterMutationHook);
eventEmitter.on(EVENTS.mutation.success, successMutationHook);
eventEmitter.on(EVENTS.mutation.error, errorMutationHook);
eventEmitter.on(EVENTS.devtools.update, () => api.sendInspectorState(DEVTOOLS_ID));
});
Expand Down

0 comments on commit 8796aef

Please sign in to comment.