test(tanstackstart-react): Wait for hydration before clicking client-error button#21065
Merged
mydea merged 1 commit intoMay 20, 2026
Merged
Conversation
nicohrubec
approved these changes
May 20, 2026
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
data-hydrated="true"on<html>) in__root.tsxof the tanstackstart-react e2e app, set in auseEffectso it fires only after React hydration completes.errors.test.ts:9,tunnel.test.ts:17) to wait on that marker before clicking the "Break the client" button.Root cause (shared by three reported flakes)
#20641, #20685, and #20867 all fail with the same pattern:
…after the same test step: click "Break the client", await the error event. The three issues differ only in which variant they were captured in (tunnel-object, tunnel-static, proxy). Same root cause.
The "Break the client" button is server-rendered HTML; its onClick handler (
() => { throw new Error('Sentry Client Test Error'); }) is attached only when React hydrates. Playwright'stoBeVisible()polls the DOM for visibility but doesn't wait for hydration — on slow CI runs, the click can fire before React has attached the handler. With no handler attached, the click does nothing, no error is thrown, the Sentry SDK never sees an error, andawait errorEventPromisetimes out at 30 s.Fix
In
__root.tsx:The
useEffectonly runs on the client after hydration. Tests now wait on it explicitly:This is the standard Playwright + SSR-React pattern. Deterministic (no
networkidleflakiness), self-documenting, and the marker is now reusable for any future client-interaction test in this app.Fixes #20641
Fixes #20685
Fixes #20867
🤖 Generated with Claude Code