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 Apr 11, 2022
1 parent d9a0f9e commit 01e2bff
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 01e2bff

Please sign in to comment.