Skip to content

Conversation

@jorge-cab
Copy link
Contributor

@jorge-cab jorge-cab commented Oct 23, 2025

Summary:
With this we are now comparing a snapshot of the derivationCache with the new changes every time we are done recording the derivations happening in the HIR.

We have to do this after recording everything since we still do some mutations on the cache when recording mutations.

Test Plan:
Test the following in playground:

// @validateNoDerivedComputationsInEffects_exp

function Component({ value }) {
  const [checked, setChecked] = useState('');

  useEffect(() => {
    setChecked(value === '' ? [] : value.split(','));
  }, [value]);

  return (
    <div>{checked}</div>
  )
}

This no longer causes an infinite loop.

Added a test case in the next PR in the stack


Stack created with Sapling. Best reviewed with ReviewStack.

@meta-cla meta-cla bot added the CLA Signed label Oct 23, 2025
@jorge-cab jorge-cab changed the title [compiler] Prevent overriding a derivationEntry and instead aggregate them [compiler] Prevent overriding a derivationEntry on effect mutation and instead update typeOfValue Oct 23, 2025
@jorge-cab jorge-cab changed the title [compiler] Prevent overriding a derivationEntry on effect mutation and instead update typeOfValue [compiler] Prevent overriding a derivationEntry on effect mutation and instead update typeOfValue and fix infinite loops Oct 27, 2025
…d instead update typeOfValue and fix infinite loops

Summary:
With this we are now comparing a snapshot of the derivationCache with the new changes every time we are done recording the derivations happening in the HIR.

We have to do this after recording everything since we still do some mutations on the cache when recording mutations.



Test Plan:
Test the following in playground:
```
// @validateNoDerivedComputationsInEffects_exp

function Component({ value }) {
  const [checked, setChecked] = useState('');

  useEffect(() => {
    setChecked(value === '' ? [] : value.split(','));
  }, [value]);

  return (
    <div>{checked}</div>
  )
}
```

This no longer causes an infinite loop.

Added a test case in the next PR in the stack
@jorge-cab jorge-cab marked this pull request as ready for review October 28, 2025 01:25
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.

2 participants