fix: add waiter token to _flush so settled() waits for pending RAF#23
Merged
NullVoxPopuli merged 1 commit intoApr 9, 2026
Merged
Conversation
Without this, settled() can return before a pending requestAnimationFrame callback fires. This causes test failures with async data sources like PromiseArrays — settled() finds no active waiter tokens during the gap between render and promise resolution, so it returns early before items are available. The fix adds waiter.beginAsync() when scheduling the RAF in _flush(), and waiter.endAsync() in flush() after all queued work completes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
NullVoxPopuli-ai-agent
force-pushed
the
fix/flush-waiter-token
branch
from
April 9, 2026 22:46
c82191a to
f12b7c5
Compare
NullVoxPopuli
approved these changes
Apr 9, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_flush()schedules work viarequestAnimationFramebut has no test waiter token covering the RAF callback. This meanssettled()can return before the RAF fires, causing test failures with async data sources like PromiseArrays.Root cause
The individual
job()waiter tokens only activate when scheduler work is queued. Butsettled()can "slip through" during the gap between when the RAF is scheduled and when it fires — there's no waiter tellingsettled()that async work is pending.Fix
3 lines:
waiter.beginAsync()in_flush()when scheduling the RAFwaiter.endAsync()inflush()after work completes_flushTokenin the constructor (needed forObject.sealin dev)Reproduction
This was discovered in html-next/vertical-collection#522 where all
Static PromiseArraytests failed (12 failures — some assertion failures, some 60s timeouts). The same fix applied there resolves all failures: html-next/vertical-collection#560🤖 Generated with Claude Code