Skip to content

Conversation

@josephsavona
Copy link
Member

@josephsavona josephsavona commented Aug 7, 2025

No description provided.

@meta-cla meta-cla bot added the CLA Signed label Aug 7, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Aug 7, 2025
@josephsavona josephsavona merged commit f468d37 into main Aug 7, 2025
27 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 7, 2025
github-actions bot pushed a commit that referenced this pull request Aug 7, 2025
github-actions bot pushed a commit to code/lib-react that referenced this pull request Aug 10, 2025
github-actions bot pushed a commit to code/lib-react that referenced this pull request Aug 10, 2025
josephsavona added a commit that referenced this pull request Aug 15, 2025
If you have a ref that the compiler doesn't know is a ref (say, a value
returned from a custom hook) and try to assign its `.current = ...`, we
currently fail with a generic error that hook return values are not
mutable. However, an assignment to `.current` specifically is a very
strong hint that the value is likely to be a ref. So in this PR, we
track the reason for the mutation and if it ends up being an error, we
use it to show an additional hint to the user. See the fixture for an
example of the message.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34125).
* #34126
* __->__ #34125
* #34124
github-actions bot pushed a commit that referenced this pull request Aug 15, 2025
If you have a ref that the compiler doesn't know is a ref (say, a value
returned from a custom hook) and try to assign its `.current = ...`, we
currently fail with a generic error that hook return values are not
mutable. However, an assignment to `.current` specifically is a very
strong hint that the value is likely to be a ref. So in this PR, we
track the reason for the mutation and if it ends up being an error, we
use it to show an additional hint to the user. See the fixture for an
example of the message.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34125).
* #34126
* __->__ #34125
* #34124

DiffTrain build for [724b324](724b324)
github-actions bot pushed a commit that referenced this pull request Aug 15, 2025
If you have a ref that the compiler doesn't know is a ref (say, a value
returned from a custom hook) and try to assign its `.current = ...`, we
currently fail with a generic error that hook return values are not
mutable. However, an assignment to `.current` specifically is a very
strong hint that the value is likely to be a ref. So in this PR, we
track the reason for the mutation and if it ends up being an error, we
use it to show an additional hint to the user. See the fixture for an
example of the message.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34125).
* #34126
* __->__ #34125
* #34124

DiffTrain build for [724b324](724b324)
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