File tree Expand file tree Collapse file tree 4 files changed +4
-28
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 4 files changed +4
-28
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ import {
3939 createFiberFromText ,
4040 createFiberFromPortal ,
4141} from './ReactFiber.new' ;
42- import { emptyRefsObject } from './ReactFiberClassComponent.new' ;
4342import { isCompatibleFamilyForHotReloading } from './ReactFiberHotReloading.new' ;
4443import { StrictLegacyMode } from './ReactTypeOfMode' ;
4544import { getIsHydrating } from './ReactFiberHydrationContext.new' ;
@@ -192,11 +191,7 @@ function coerceRef(
192191 return current . ref ;
193192 }
194193 const ref = function ( value ) {
195- let refs = resolvedInst . refs ;
196- if ( refs === emptyRefsObject ) {
197- // This is a lazy pooled frozen object, so we need to initialize.
198- refs = resolvedInst . refs = { } ;
199- }
194+ const refs = resolvedInst . refs ;
200195 if ( value === null ) {
201196 delete refs [ stringRef ] ;
202197 } else {
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ import {
3939 createFiberFromText ,
4040 createFiberFromPortal ,
4141} from './ReactFiber.old' ;
42- import { emptyRefsObject } from './ReactFiberClassComponent.old' ;
4342import { isCompatibleFamilyForHotReloading } from './ReactFiberHotReloading.old' ;
4443import { StrictLegacyMode } from './ReactTypeOfMode' ;
4544import { getIsHydrating } from './ReactFiberHydrationContext.old' ;
@@ -192,11 +191,7 @@ function coerceRef(
192191 return current . ref ;
193192 }
194193 const ref = function ( value ) {
195- let refs = resolvedInst . refs ;
196- if ( refs === emptyRefsObject ) {
197- // This is a lazy pooled frozen object, so we need to initialize.
198- refs = resolvedInst . refs = { } ;
199- }
194+ const refs = resolvedInst . refs ;
200195 if ( value === null ) {
201196 delete refs [ stringRef ] ;
202197 } else {
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import type {Lanes} from './ReactFiberLane.new';
1212import type { UpdateQueue } from './ReactFiberClassUpdateQueue.new' ;
1313import type { Flags } from './ReactFiberFlags' ;
1414
15- import * as React from 'react' ;
1615import {
1716 LayoutStatic ,
1817 Update ,
@@ -80,12 +79,6 @@ import {
8079
8180const fakeInternalInstance = { } ;
8281
83- // React.Component uses a shared frozen object by default.
84- // We'll use it to determine whether we need to initialize legacy refs.
85- export const emptyRefsObject : $FlowFixMe = React . Component
86- ? new React . Component ( ) . refs
87- : { } ;
88-
8982let didWarnAboutStateAssignmentForComponent ;
9083let didWarnAboutUninitializedState ;
9184let didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate ;
@@ -836,7 +829,7 @@ function mountClassInstance(
836829 const instance = workInProgress . stateNode ;
837830 instance . props = newProps ;
838831 instance . state = workInProgress . memoizedState ;
839- instance . refs = emptyRefsObject ;
832+ instance . refs = { } ;
840833
841834 initializeUpdateQueue ( workInProgress ) ;
842835
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import type {Lanes} from './ReactFiberLane.old';
1212import type { UpdateQueue } from './ReactFiberClassUpdateQueue.old' ;
1313import type { Flags } from './ReactFiberFlags' ;
1414
15- import * as React from 'react' ;
1615import {
1716 LayoutStatic ,
1817 Update ,
@@ -80,12 +79,6 @@ import {
8079
8180const fakeInternalInstance = { } ;
8281
83- // React.Component uses a shared frozen object by default.
84- // We'll use it to determine whether we need to initialize legacy refs.
85- export const emptyRefsObject : $FlowFixMe = React . Component
86- ? new React . Component ( ) . refs
87- : { } ;
88-
8982let didWarnAboutStateAssignmentForComponent ;
9083let didWarnAboutUninitializedState ;
9184let didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate ;
@@ -836,7 +829,7 @@ function mountClassInstance(
836829 const instance = workInProgress . stateNode ;
837830 instance . props = newProps ;
838831 instance . state = workInProgress . memoizedState ;
839- instance . refs = emptyRefsObject ;
832+ instance . refs = { } ;
840833
841834 initializeUpdateQueue ( workInProgress ) ;
842835
You can’t perform that action at this time.
0 commit comments