Repository navigation
test: preload the lazy highlighter in mount() (intermittent 'streaming markdown chunks' hookFailed) - #1510
Merged
Conversation
… inside act useHighlightedBlock/useHighlightedLines setState after the lazy highlight.js chunk loads (#1500). When that promise resolved between act scopes, React logged 'not wrapped in act' and the console.error gate failed a later hook: the intermittent 'streaming markdown chunks' hookFailed on CI (#1505, #1507). Preloading it once in mount() (like preloadLazyNamed) makes every later then-callback a microtask inside act. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
Author
|
Cause confirmed. It reproduced locally in a full renderer-suite run on main merged with #1509, without this fix:
|
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.
Symptom: "streaming markdown chunks › final DOM after a chunked stream equals a one-shot mount" has failed intermittently on macOS CI with
failureType: 'hookFailed', on two unrelated PRs (#1505 and #1507). The hook that fails is the globalafterEach(unmountAll)intest/support/dom.ts. It throws when React logged any console.error while a component was mounted.Likely cause: test 15 is the first test in that file to mount fenced code with a known language (
ts,md).useHighlightedBlockcallssetStateafter the lazy highlight.js chunk (#1500) loads. If that import resolves between act scopes, React warns "not wrapped in act" and the gate fails the hook.Fix:
mount()now preloads the highlighter, the same way it already preloads lazy views (preloadLazyNamed). Every laterthencallback is then a microtask inside act. A tinypreloadHighlighter()export is added insrc/syntaxHighlight.ts.Honest note: I could not reproduce the failure locally. Delays of 5 to 1500 ms injected into the engine load didn't trigger it, and the failed attempt's log was overwritten by the passing re-run. This removes the one known path for an out-of-act update in that test, but it isn't proven to be the cause. The merge script now keeps full failure logs, so a recurrence will show the actual console.error.
test:renderer passes 2806 of 2806.
🤖 Generated with Claude Code