Repository navigation
Make e2e specs wait for hydration before touching the showcase - #408
Merged
TrevorBurnham merged 1 commit intoNov 28, 2026
Merged
Conversation
👷 Deploy request for react-arborist pending review.Visit the deploys page to approve it
|
2 tasks done
Collaborator
|
Thanks! |
2 tasks done
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
Fixes the intermittent
budget-spec.cy.jsfailure ("updates folder totals when an expense moves between folders"), first reported in #404. It also failed on #407.How often: in the last 100
Build & Testruns, 7 of the 9 failures were this test, always the same assertion ('📂Entertainment$0'where$60was expected), on 5 unrelated branches. That's about 1 in 5 of the runs that reached Cypress since the spec landed in #401. Branches failed and then passed on the next commit with no related change. The spec andpages/budget.tsxhaven't changed since #401, so this is not a regression. The test has been racy since it was added.Cause: the showcase is a Next static export, so
/budgetarrives as HTML with all 15 rows already rendered.cy.visitonly waits forload, and React 18 hydrates in time slices that can finish after it. When Cypress fires the synthetic drag before hydration, react-dnd hasn't attached its listeners yet, and the drag does nothing. There's no error, because no handler runs at all. Every drag spec has this race. Budget loses it because it's alphabetically first, so it runs on a cold browser where hydration is slowest.Repro: a throwaway spec (not committed) delayed the page chunk with
setTimeout(…, 1500)viacy.intercept, so the rows are on screen while React hasn't hydrated. Onmain, the budget drag fails with exactly the CI message, and the drag-out drag fails the same way. With this PR, both pass.Fix:
pages/_app.tsxsetsdata-hydratedon<html>in auseEffect. Passive effects run after the commit's layout effects, which is where react-dnd registers its sources and sets up the backend listeners, so the marker means the page is interactive.cy.visitHydrated(url)command:cy.visit(url), then wait forhtml[data-hydrated]. All five specs use it.The marker is not in the exported HTML. It only appears once React runs.
Checklist
.changes/entry describing the change (see.changes/README.md), or applied theskip-changeloglabel if it has no user-facing effect.yarn lint,yarn fmt:check, andyarn workspace react-arborist testpass (warning-clean — seeAGENTS.md).No changeset: test and showcase only, nothing in
modules/react-arborist/src.yarn workspace e2e: 22/22 locally, plus both repro cases with hydration delayed.