Skip to content

Commit

Permalink
Remove unnecessary check (facebook#24332)
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-lx authored and zhengjitf committed Apr 15, 2022
1 parent 3646cb2 commit 6aa7560
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 6aa7560

Please sign in to comment.