Skip to content

Commit 0160f82

Browse files
ENvironmentSetclaudeorionmiz
authored
fix(core): prevent incorrect transition state when transitionDuration is 0 (#691)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: JH.Lee <contact@jins.dev>
1 parent 862e9c6 commit 0160f82

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/core": patch
3+
---
4+
5+
Fix intermittent incorrect transition state when `transitionDuration` is set to 0 by ensuring `now >= eventDate` in the initial aggregate call within `dispatchEvent`.

core/src/makeCoreStore.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ export function makeCoreStore(options: MakeCoreStoreOptions): CoreStore {
9292
},
9393
dispatchEvent(name, params) {
9494
const newEvent = makeEvent(name, params);
95+
9596
const nextStackValue = aggregate(
9697
[...events.value, newEvent],
97-
new Date().getTime(),
98+
Math.max(newEvent.eventDate, new Date().getTime()),
9899
);
99100

100101
events.value.push(newEvent);

0 commit comments

Comments
 (0)