Skip to content

The Help view test waits for the scroll to the cited section - #511

Merged
zlareb1 merged 1 commit into
mainfrom
fix/help-test-scroll-wait
Nov 10, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
fix/help-test-scroll-wait

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 10, 2026

Copy link
Copy Markdown
Member

Related: #498

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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 2 fails by turns since #498 added frontend/src/views/Help.test.tsx: in 3 of about 20 CI runs (on main and on two unrelated docs branches), Help > reads the page the URL names and scrolls to the cited section failed with expected "vi.fn()" to be called at least once, at its check that the cited heading was scrolled to.

Help.tsx scrolls in a useEffect that runs after the render that draws the page. findByRole resolves 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 with waitFor; 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

  • Wire: none.
  • Operator steps: none.
  • Rollback: none needed.

Tests

npx vitest run src/views/Help.test.tsx in frontend/: 5 passed, three times. The race did not reproduce locally on main either (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-check and make lint pass for the changed file (biome format and biome lint); no Python changes.
  • Generated files: not applicable, none changes.
  • A new migration: not applicable.
  • Plugin files: not applicable.
  • The frontend's tests pass for the changed file; CI runs the rest and the build.
  • Docs: not applicable, no behaviour changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

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>
@zlareb1
zlareb1 merged commit ad8156e into main Nov 10, 2026
36 of 37 checks passed
@zlareb1
zlareb1 deleted the fix/help-test-scroll-wait branch November 10, 2026 21:27
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