Skip to content

Conversation

jbrown215
Copy link
Contributor

@jbrown215 jbrown215 commented Jul 16, 2025

No description provided.

@@ -183,6 +183,16 @@ export function inferEffectDependencies(fn: HIRFunction): void {
autodepFnLoads.has(callee.identifier.id) &&
value.args[0].kind === 'Identifier'
) {
const autodepsArgExpectedIndex = autodepFnLoads.get(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should we also also remove the check on value.args.length > 1 && autodepsArgIndex > 0 above, since we also assert this in the environment? This way we'd get InvalidReact errors for useEffect(AUTODEPS) if that's something we care about

Copy link
Contributor Author

@jbrown215 jbrown215 Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think value.args.length > 0 should suffice. need to keep > 0 to check the 0th index in the RHS of && and autodepsArgIndex => 0 because we should only be trying to insert the deps if AUTODEPS exists in the arg list. That should catch the useEffect(AUTODEPS) case, will add a test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up going for a different approach here because if we throw an error in the autodeps pass then we don't report the build error (? I should follow up with a fix for that).

In ValidateNoUntransformedReferences we instead check to see if any of the args are AUTODEPS instead of just the expected one. This surfaced a handful of new files that were not updated to the AUTODEPS approach, see the updated tests!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this makes a lot of sense, lets ship it!

This surfaced a handful of new files that were not updated to the AUTODEPS approach

Ohh I'm curious what files were -- were we previously supplying AUTODEPS in an unexpected position, e.g. autodepsIndex + 1?

Copy link
Contributor

@mofeiZ mofeiZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

jbrown215 added a commit that referenced this pull request Jul 17, 2025
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33799).
* #33800
* __->__ #33799
github-actions bot pushed a commit that referenced this pull request Jul 17, 2025
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33799).
* #33800
* __->__ #33799

DiffTrain build for [dffacc7](dffacc7)
github-actions bot pushed a commit that referenced this pull request Jul 17, 2025
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33799).
* #33800
* __->__ #33799

DiffTrain build for [dffacc7](dffacc7)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Jul 20, 2025
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33799).
* facebook#33800
* __->__ facebook#33799

DiffTrain build for [dffacc7](facebook@dffacc7)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Jul 20, 2025
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33799).
* facebook#33800
* __->__ facebook#33799

DiffTrain build for [dffacc7](facebook@dffacc7)
@jbrown215 jbrown215 merged commit 074e927 into facebook:main Jul 21, 2025
22 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 21, 2025
github-actions bot pushed a commit that referenced this pull request Jul 21, 2025
@eps1lon eps1lon mentioned this pull request Jul 25, 2025
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