Skip to content

ticker: fix follow-up for initial seed + display reset - #1259

Merged
Flotapponnier merged 1 commit into
mainfrom
fix/ticker-sanity-clamp
Jul 17, 2026
Merged

ticker: fix follow-up for initial seed + display reset#1259
Flotapponnier merged 1 commit into
mainfrom
fix/ticker-sanity-clamp

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Follow-up to #1258. First fix left the initial useState seed unguarded and never reset display when a poisoned value came in. Now both paths are covered.

Follow-up to #1258. The initial fix rejected future ticks above the
ceiling but left two paths for the garbage to stick:

1. useState was seeded with the raw value on mount, so the very first
   render painted 8.26e79 before any effect ran. The monotonic guard
   then rejected every healthy value that followed as a down tick.
2. Even after flushing lastRef, the display state still held the
   garbage, and the raf tick was returning early on lastRef=null so
   setDisplay was never called with a smaller-but-healthy value.

Fix: guard the useState seed too, and reset display to undefined when
an above-ceiling value arrives. A subsequent healthy push then seeds
both lastRef and display fresh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant