File tree 1 file changed +19
-1
lines changed
packages/react-devtools-shared/src/backend/fiber
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3345,13 +3345,31 @@ export function attach(
3345
3345
fiberInstance . firstChild = null ;
3346
3346
}
3347
3347
try {
3348
- if ( nextFiber . tag === HostHoistable ) {
3348
+ if (
3349
+ nextFiber . tag === HostHoistable &&
3350
+ prevFiber . memoizedState !== nextFiber . memoizedState
3351
+ ) {
3349
3352
const nearestInstance = reconcilingParent ;
3350
3353
if ( nearestInstance === null ) {
3351
3354
throw new Error ( 'Did not expect a host hoistable to be the root' ) ;
3352
3355
}
3353
3356
releaseHostResource ( nearestInstance , prevFiber . memoizedState ) ;
3354
3357
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 ) ;
3355
3373
}
3356
3374
3357
3375
const isSuspense = nextFiber . tag === SuspenseComponent ;
You can’t perform that action at this time.
0 commit comments