Repository navigation
Add getPromiseState microtask timing tests - #207
Merged
Merged
Conversation
Read the state from JS without rendering, and record which microtask isLoading, error, and resolved change on for each kind of input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
Adds tests that read
getPromiseStatefrom JS, with norender()orsettled(), and record which microtask each property changes on. No behavior changes.Results
resolved/errorsetisLoading→ falsePromise.resolve,async () => valuePromise.rejectasyncfn with oneawaitasyncfn that awaits, then throwsNothing changes after a macrotask.
Worth noting: for promises, there's a window of 1–2 microtasks where
resolved(orerror) is set butisLoadingis stilltrue. This happens because the state is updated in a.then().catch().finally()chain, one link per microtask. Templates never show it because they wait for the render loop. JS code that checksisLoadingfirst could see it. These tests pin it down so any fix is deliberate.How it works: a
stepTimeline(state, assert)helper reads the state right after the call, after each of 10await Promise.resolve()s, and after asetTimeout. Each time the state changes, it callsassert.step, and the test checks the result withassert.verifySteps.🤖 Generated with Claude Code