Skip to content

Conversation

jorge-cab
Copy link
Contributor

@jorge-cab jorge-cab commented Sep 24, 2025

@mayborn-05

This comment was marked as off-topic.

@CodiumAI-Agent

This comment was marked as off-topic.

@mayborn-05

This comment was marked as off-topic.

@CodiumAI-Agent

This comment was marked as off-topic.

@mayborn-05

This comment was marked as off-topic.

@CodiumAI-Agent

This comment was marked as off-topic.

@jorge-cab jorge-cab force-pushed the pr34580 branch 3 times, most recently from 4dfe0b8 to b80f0f7 Compare September 24, 2025 21:02
Summary:
This creates the test cases we expect this first iteration of calculate in render to catch

The goal is to have tests that will be in a good state once we have the first iteration of the calculate in render validation working, which should be pretty limited in what its capturing.

Test Plan:
Test cases
…k prop and local state derived values variables and add extra tests

Summary:
Biggest change of the stack, we track how values prop and local state values are derived throughout the entire component.

We are iterating over instructions instead of effects since some mutations can not be caught otherwise.

For every derivation we track the type of value its coming from (props or local state) and also the top most relevant sources (These would be the ones that are actually named instead of promoted like t0)

We propagate these relevant sources to each derivation.

This allows us to catch more complex useEffects though right now we are overcapturing some more complex cases which will be refined further up the stack.

This PR also adds a couple tests we will work towards fixing

Test Plan:
Added:
ref-conditional-in-effect-no-error
effect-contains-prop-function-call-no-error
derived-state-from-ref-and-state-no-error
… effect

Summary:
Using refs in an effect signify we are synchronizing with external state so to avoid overcapturing we just bail when we encounter one
…ction call in the effect

Summary:
Global function calls can introduce unexpected side effects, for this first iteration we are bailing out the validation when we encounter one.

Local function calls remain
…ed outside of the effect

Summary:
If the setter is used both inside and outside the effect then usually the solution is more complex and requires hoisting state up to a parent component since we can't just remove the local state.

To do this, we now have 2 caches that track setState usages (not just calls) since if the effect is passed as an argument or called outside the effect the solution gets more complex which we are trying to avoid for now
Summary:
Change error and update snapshots

The error now mentions what values are causing the issue which should provide better context on how to fix the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants