You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve React error message when mutable sources are mutated during render (#20665)
Changed previous error message from:
> Cannot read from mutable source during the current render without tearing. This is a bug in React. Please file an issue.
To:
> Cannot read from mutable source during the current render without tearing. This may be a bug in React. Please file an issue.
Also added a DEV only warning about the unsafe side effect:
> A mutable source was mutated while the %s component was rendering. This is not supported. Move any mutations into event handlers or effects.
I think this is the best we can do without adding production overhead that we'd probably prefer to avoid.
Copy file name to clipboardexpand all lines: scripts/error-codes/codes.json
+2-1
Original file line number
Diff line number
Diff line change
@@ -372,5 +372,6 @@
372
372
"381": "This feature is not supported by ReactSuspenseTestUtils.",
373
373
"382": "This query has received more parameters than the last time the same query was used. Always pass the exact number of parameters that the query needs.",
374
374
"383": "This query has received fewer parameters than the last time the same query was used. Always pass the exact number of parameters that the query needs.",
375
-
"384": "Refreshing the cache is not supported in Server Components."
375
+
"384": "Refreshing the cache is not supported in Server Components.",
376
+
"385": "Cannot read from mutable source during the current render without tearing. This may be a bug in React. Please file an issue."
0 commit comments