test(react-grab): cover freeze pause/resume for non-useState hooks - #499
Closed
aidenybai wants to merge 2 commits into
Closed
test(react-grab): cover freeze pause/resume for non-useState hooks#499aidenybai wants to merge 2 commits into
aidenybai wants to merge 2 commits into
Conversation
Adds a FreezeHookHarness fixture (useReducer, useTransition, useSyncExternalStore, and a context consumer/provider) plus a freeze-hooks spec asserting each counter holds frozen during prompt-mode freeze and resumes normal updates after unfreeze. This drives the freeze-updates.ts pause/resume paths the useState-only freeze-updates spec never reached, notably context-dependency pause/resume.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
…tle waits - Move FreezeHookHarness into its own module (mirrors PerfGrid), keeping App.tsx a composition root and relocating the external-store singleton. - Correct the misleading "bypasses useState" comments (transition/context counters update via useState) and document the synthetic-click quirk. - Add settle waits so the freeze-hold assertion can catch a leaked update and the post-unfreeze baseline is stable; guard readCount against a missing node; narrow the combined test to the simultaneity claim.
4 tasks
Owner
Author
|
Superseded by #510, which consolidates all the test-coverage PRs into one. Commits preserved there. |
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
freeze-updates.ts(the "inherently fragile" React-internals module) was only exercised viauseState, leavinguseReducer/useTransition/useSyncExternalStorehook-queue pausing and the entire context-dependency pause/resume block (lines 237–296) at 0%.FreezeHookHarnessto the Vite fixture (useReducer,useTransition,useSyncExternalStore, and auseContextprovider/consumer), each bumped by a handler that bypassesuseState.freeze-hooks.spec.ts(5 tests) asserting each counter is held frozen during prompt-mode freeze and resumes normal updates after unfreeze.Scoped to just the freeze specs,
freeze-updates.tsmoved from 55.67% → 61.94% lines (with the context-dependency paths now executing); higher across the full suite.Notes
handleTrackPointerUpshows hits whilehandleTrackPointerDownshows 0 — impossible in a real drag), so no tests were added there and coverage config was left untouched rather than gamed.Test plan
freeze-hooks.spec.ts— 5/5 passpnpm typecheckcleanpnpm lint— 0 warnings / 0 errorsNote
Low Risk
Test-only changes to the e2e app and Playwright specs; no production freeze or runtime logic is modified.
Overview
Adds e2e coverage for react-grab’s page-freeze behavior on React hooks beyond
useState, which existingfreeze-updatestests did not exercise (including context-dependency pause/resume infreeze-updates.ts).A new
FreezeHookHarnesson the Vite fixture exposes counters driven byuseReducer,useTransition,useSyncExternalStore, and a context consumer.freeze-hooks.spec.ts(five cases) enters prompt-mode freeze, bumps each counter via synthetic clicks (overlay-safe), asserts values stay fixed while frozen, then checks updates resume after unfreeze; one test asserts all four counters stay frozen in a single freeze cycle.Reviewed by Cursor Bugbot for commit 198e9c8. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds a
FreezeHookHarnessto the Vite E2E app and 5 tests covering freeze pause/resume for non-useStatehooks (useReducer,useTransition,useSyncExternalStore, and context). This exercises hook-queue and context-dependency paths infreeze-updates.ts, raising freeze spec line coverage from 55.67% to 61.94%.Written for commit 198e9c8. Summary will update on new commits.