Skip to content

FPFNFIXAPEX detect captured state updates after await - #2219

Draft
aidenybai wants to merge 1 commit into
fix/imported-plain-class-empty-defaultfrom
fix/post-await-state-snapshots
Draft

aidenybai wants to merge 1 commit into
fix/imported-plain-class-empty-defaultfrom
fix/post-await-state-snapshots

Conversation

@aidenybai

Copy link
Copy Markdown
Member

Catches captured React state calculations after supported await continuations. An asynchronous callback can overwrite updates committed while it was waiting:

const received = await read();
setItems([...items, received]);

The functional updater remains quiet:

setItems(currentItems => [...currentItems, received]);

The existing rule now admits supported own-function awaits, using the existing hook-binding, mutation and control-flow helpers. Synchronous prefixes, functional updates, shadowed/rebound values and unsupported loop or exception paths remain outside the new admission. Existing deferred-wrapper and synchronous-update behavior is preserved.

Validation:

  • 69 new rule cases; 89 focused tests pass.
  • Full repository suite: 36,202 pass, 1,118 skipped.
  • Native engine: 69 isolated synthetic projects plus two variants of one local project; complete coverage checked. The selected warning appears only in the captured-state variant.
  • Strict fuzzing, 500 iterations, seed 42: 2,103 programs executed, 3 fired, no findings.
  • Build, typecheck, format check, JSON-schema smoke and fuzz-package checks pass.
  • Lint passes with the existing 765 warnings and no diagnostics in changed files. Subsequent fixture-only lint cleanup was checked with the fuzz suite.

Adds patch changesets for the CLI and both plugins. Remote parity was skipped at the requester’s direction; the local RDE checkout is unavailable. This PR is stacked on #2218.

@pkg-pr-new

pkg-pr-new Bot commented Oct 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@2219
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@2219
npm i https://pkg.pr.new/react-doctor@2219

commit: 40bf5e1

This branch has not been deployed

No deployments
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