dillon1000/react
Commit
Browse files 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.
Changed paths6 files
First-parent comparisonpackages/react-reconciler/src/ReactFiberHooks.new.js ModifiedM packages/react-reconciler/src/ReactFiberHooks.old.js ModifiedM packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js ModifiedM packages/react/src/ReactMutableSource.js ModifiedM packages/shared/ReactTypes.js ModifiedM scripts/error-codes/codes.json ModifiedPatch
Files changed
Rendering syntax-highlighted changes…