File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
packages/react-devtools-shared/src/backend/fiber Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3345,13 +3345,31 @@ export function attach(
33453345 fiberInstance . firstChild = null ;
33463346 }
33473347 try {
3348- if ( nextFiber . tag === HostHoistable ) {
3348+ if (
3349+ nextFiber . tag === HostHoistable &&
3350+ prevFiber . memoizedState !== nextFiber . memoizedState
3351+ ) {
33493352 const nearestInstance = reconcilingParent ;
33503353 if ( nearestInstance === null ) {
33513354 throw new Error ( 'Did not expect a host hoistable to be the root' ) ;
33523355 }
33533356 releaseHostResource ( nearestInstance , prevFiber . memoizedState ) ;
33543357 aquireHostResource ( nearestInstance , nextFiber . memoizedState ) ;
3358+ } else if (
3359+ ( nextFiber . tag === HostComponent ||
3360+ nextFiber . tag === HostText ||
3361+ nextFiber . tag === HostSingleton ) &&
3362+ prevFiber . stateNode !== nextFiber . stateNode
3363+ ) {
3364+ // In persistent mode, it's possible for the stateNode to update with
3365+ // a new clone. In that case we need to release the old one and aquire
3366+ // new one instead.
3367+ const nearestInstance = reconcilingParent ;
3368+ if ( nearestInstance === null ) {
3369+ throw new Error ( 'Did not expect a host hoistable to be the root' ) ;
3370+ }
3371+ releaseHostInstance ( nearestInstance , prevFiber . stateNode ) ;
3372+ aquireHostInstance ( nearestInstance , nextFiber . stateNode ) ;
33553373 }
33563374
33573375 const isSuspense = nextFiber . tag === SuspenseComponent ;
You can’t perform that action at this time.
0 commit comments