Skip to content

Conversation

@poteto
Copy link
Member

@poteto poteto commented Dec 5, 2025

The current validateNoSetStateInEffects error has potential false positives because
we cannot fully statically detect patterns where calling setState in an effect is
actually valid. This flag enableVerboseNoSetStateInEffect adds a verbose error mode that presents multiple possible
use-cases, allowing an agent to reason about which fix is appropriate before acting:

  1. Non-local derived data - suggests restructuring state ownership
  2. Derived event pattern - suggests requesting an event callback from parent
  3. Force update / external sync - suggests using useSyncExternalStore

This gives agents the context needed to make informed decisions rather than
blindly applying a fix that may not be correct for the specific situation.

@meta-cla meta-cla bot added the CLA Signed label Dec 5, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Dec 5, 2025
…user/agent

The current `validateNoSetStateInEffects` error has potential false positives because
we cannot fully statically detect patterns where calling setState in an effect is
actually valid. This flag `enableVerboseNoSetStateInEffect` adds a verbose error mode that presents multiple possible
use-cases, allowing an agent to reason about which fix is appropriate before acting:

1. Non-local derived data - suggests restructuring state ownership
2. Derived event pattern - suggests requesting an event callback from parent
3. Force update / external sync - suggests using `useSyncExternalStore`

This gives agents the context needed to make informed decisions rather than
blindly applying a fix that may not be correct for the specific situation.
@poteto poteto merged commit 3640f38 into main Dec 8, 2025
18 checks passed
@poteto poteto deleted the pr35306 branch December 8, 2025 17:16
github-actions bot pushed a commit that referenced this pull request Dec 8, 2025
…user/agent (#35306)

The current `validateNoSetStateInEffects` error has potential false
positives because
we cannot fully statically detect patterns where calling setState in an
effect is
actually valid. This flag `enableVerboseNoSetStateInEffect` adds a
verbose error mode that presents multiple possible
use-cases, allowing an agent to reason about which fix is appropriate
before acting:

1. Non-local derived data - suggests restructuring state ownership
2. Derived event pattern - suggests requesting an event callback from
parent
3. Force update / external sync - suggests using `useSyncExternalStore`

This gives agents the context needed to make informed decisions rather
than
blindly applying a fix that may not be correct for the specific
situation.

DiffTrain build for [3640f38](3640f38)
github-actions bot pushed a commit that referenced this pull request Dec 8, 2025
…user/agent (#35306)

The current `validateNoSetStateInEffects` error has potential false
positives because
we cannot fully statically detect patterns where calling setState in an
effect is
actually valid. This flag `enableVerboseNoSetStateInEffect` adds a
verbose error mode that presents multiple possible
use-cases, allowing an agent to reason about which fix is appropriate
before acting:

1. Non-local derived data - suggests restructuring state ownership
2. Derived event pattern - suggests requesting an event callback from
parent
3. Force update / external sync - suggests using `useSyncExternalStore`

This gives agents the context needed to make informed decisions rather
than
blindly applying a fix that may not be correct for the specific
situation.

DiffTrain build for [3640f38](3640f38)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Dec 12, 2025
…user/agent (facebook#35306)

The current `validateNoSetStateInEffects` error has potential false
positives because
we cannot fully statically detect patterns where calling setState in an
effect is
actually valid. This flag `enableVerboseNoSetStateInEffect` adds a
verbose error mode that presents multiple possible
use-cases, allowing an agent to reason about which fix is appropriate
before acting:

1. Non-local derived data - suggests restructuring state ownership
2. Derived event pattern - suggests requesting an event callback from
parent
3. Force update / external sync - suggests using `useSyncExternalStore`

This gives agents the context needed to make informed decisions rather
than
blindly applying a fix that may not be correct for the specific
situation.

DiffTrain build for [3640f38](facebook@3640f38)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Dec 12, 2025
…user/agent (facebook#35306)

The current `validateNoSetStateInEffects` error has potential false
positives because
we cannot fully statically detect patterns where calling setState in an
effect is
actually valid. This flag `enableVerboseNoSetStateInEffect` adds a
verbose error mode that presents multiple possible
use-cases, allowing an agent to reason about which fix is appropriate
before acting:

1. Non-local derived data - suggests restructuring state ownership
2. Derived event pattern - suggests requesting an event callback from
parent
3. Force update / external sync - suggests using `useSyncExternalStore`

This gives agents the context needed to make informed decisions rather
than
blindly applying a fix that may not be correct for the specific
situation.

DiffTrain build for [3640f38](facebook@3640f38)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants