Skip to content

Commit

Permalink
fix(core): notify devtools when store is created/destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcourtice committed Sep 6, 2021
1 parent b86f63c commit 5930537
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ function emitCreated(store: InternalStore, state: any): void {
This is necessary because the stores may be
created before the plugin has been installed.
*/
const created = () => store.emit(EVENTS.store.created, SENDER, state);
const created = () => {
store.emit(EVENTS.store.created, SENDER, state);
store.emit(EVENTS.devtools.update, SENDER, state);
};

if (installed) {
return created();
Expand Down Expand Up @@ -124,9 +127,10 @@ export function createStore<TState extends BaseState, TExtensions extends Extens
});

const destroy = () => {
store.emit(EVENTS.store.destroyed, SENDER, state);
stores.delete(name);
store.destroy();
store.emit(EVENTS.store.destroyed, SENDER, state);
store.emit(EVENTS.devtools.update, SENDER, state);
};

const getMutationHook = (eventName: string) => {
Expand Down

0 comments on commit 5930537

Please sign in to comment.