Skip to content

Commit

Permalink
Remove unnecessary check (#24332)
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-lx authored and rickhanlonii committed Apr 13, 2022
1 parent 8e8e5c0 commit f558d9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions packages/react-reconciler/src/ReactFiberHooks.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,10 +1624,7 @@ function mountRef<T>(initialValue: T): {|current: T|} {
},
set current(value) {
if (currentlyRenderingFiber !== null && !didWarnAboutWrite) {
if (
hasBeenInitialized ||
(!hasBeenInitialized && !didCheckForLazyInit)
) {
if (hasBeenInitialized || !didCheckForLazyInit) {
didWarnAboutWrite = true;
console.warn(
'%s: Unsafe write of a mutable value during render.\n\n' +
Expand Down
5 changes: 1 addition & 4 deletions packages/react-reconciler/src/ReactFiberHooks.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,10 +1624,7 @@ function mountRef<T>(initialValue: T): {|current: T|} {
},
set current(value) {
if (currentlyRenderingFiber !== null && !didWarnAboutWrite) {
if (
hasBeenInitialized ||
(!hasBeenInitialized && !didCheckForLazyInit)
) {
if (hasBeenInitialized || !didCheckForLazyInit) {
didWarnAboutWrite = true;
console.warn(
'%s: Unsafe write of a mutable value during render.\n\n' +
Expand Down

0 comments on commit f558d9e

Please sign in to comment.