Skip to content

Commit 824fe35

Browse files
fix(overmind): trying to get hot reloading to work
1 parent 0430fda commit 824fe35

File tree

1 file changed

+5
-3
lines changed
  • packages/node_modules/overmind/src

1 file changed

+5
-3
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -952,21 +952,23 @@ export class Overmind<ThisConfig extends IConfiguration>
952952
this.actions = this.getActions(configuration.actions)
953953
this.effects = configuration.effects || {}
954954

955+
const mutationTree = this.proxyStateTree.getMutationTree()
955956
// We change the state to match the new structure
956-
rehydrate(this.state as any, changeMutations)
957+
rehydrate(mutationTree.state as any, changeMutations)
957958

958959
// We run any mutations ran during the session, it might fail though
959960
// as the state structure might have changed, but no worries we just
960961
// ignore that
961962
this.reydrateMutationsForHotReloading.forEach((mutation) => {
962963
try {
963-
rehydrate(this.state as any, [mutation])
964+
rehydrate(mutationTree.state as any, [mutation])
964965
} catch (error) {
965966
// No worries, structure changed and we do not want to mutate anyways
966967
}
967968
})
968969

969-
this.proxyStateTree.forceFlush()
970+
mutationTree.flush()
971+
mutationTree.dispose()
970972

971973
if (this.devtools) {
972974
this.devtools.send({

0 commit comments

Comments
 (0)