From 6cd5f57d132bea2c59eaebf1a347f8257aff9383 Mon Sep 17 00:00:00 2001 From: zh-lx <18366276315@163.com> Date: Sun, 10 Apr 2022 18:45:49 +0800 Subject: [PATCH] Remove unnecessary check --- packages/react-reconciler/src/ReactFiberHooks.new.js | 5 +---- packages/react-reconciler/src/ReactFiberHooks.old.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index d1c50b42d8cbc..6a32503833385 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -1622,10 +1622,7 @@ function mountRef(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' + diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index 137ee33cba512..5f2887c76d22c 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -1622,10 +1622,7 @@ function mountRef(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' +