Skip to content

Commit

Permalink
Bugfix (core): Fix infinite loop happening if state change occured di…
Browse files Browse the repository at this point in the history
…rectly inside useEffect()
  • Loading branch information
SBoudrias committed Sep 25, 2023
1 parent 34d328f commit 835f070
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/lib/hook-engine.mts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ export const effectScheduler = {
store.hooksEffect.forEach((effect) => {
effect();
});
// Warning: Clean the hooks before exiting the `withUpdates` block.
// Failure to do so means an updates would hit the same effects again.
store.hooksEffect.length = 0;
})();
store.hooksEffect.length = 0;
},
};

0 comments on commit 835f070

Please sign in to comment.