Repository navigation
The Help view test waits for the scroll to the cited section - #511
Merged
Merged
Conversation
The scroll runs in an effect after the render that draws the heading, and findByRole can return before React runs that effect, so on a slow runner the check right after it saw no call. The test waits for the call, as the file's test of a second arrival at the page already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
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.
Related: #498
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
...
Why
frontend vitest part 2fails by turns since #498 addedfrontend/src/views/Help.test.tsx: in 3 of about 20 CI runs (onmainand on two unrelated docs branches),Help > reads the page the URL names and scrolls to the cited sectionfailed withexpected "vi.fn()" to be called at least once, at its check that the cited heading was scrolled to.Help.tsxscrolls in auseEffectthat runs after the render that draws the page.findByRoleresolves as soon as the heading is in the DOM, which can be before React runs that passive effect, so the check right after it can see no call. The file's third test, which checks the scroll on a second arrival at the page, already waits withwaitFor; this case now does the same. The assertion itself is unchanged.Scope and risk
One assertion in one test. No dashboard code changes.
Compatibility, rollout and rollback
Tests
npx vitest run src/views/Help.test.tsxinfrontend/: 5 passed, three times. The race did not reproduce locally onmaineither (12 parallel runs passed), so the evidence for the cause is the code path above and the CI failures.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. I read the effect and the test and ran the file.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-checkandmake lintpass for the changed file (biome formatandbiome lint); no Python changes.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code