Consistent handling of work tags for rename, delete, and overriding state (#35740)

Co-authored-by: Ruslan Lesiutin <28902667+hoxyq@users.noreply.github.com>
This commit is contained in:
Sebastian "Sebbie" Silbermann
2026-02-10 16:35:02 +01:00
committed by GitHub
parent f23aa1d9f5
commit 70890e7c58

View File

@@ -6859,6 +6859,8 @@ export function attach(
// TODO Show custom UI for Cache like we do for Suspense
// For now, just hide state data entirely since it's not meant to be inspected.
// Make sure delete, rename, and override of state handles all tags for which
// we show state.
const showState =
tag === ClassComponent || tag === IncompleteClassComponent;
@@ -7815,8 +7817,13 @@ export function attach(
}
break;
case 'state':
deletePathInObject(instance.state, path);
instance.forceUpdate();
switch (fiber.tag) {
case ClassComponent:
case IncompleteClassComponent:
deletePathInObject(instance.state, path);
instance.forceUpdate();
break;
}
break;
}
}
@@ -7893,8 +7900,13 @@ export function attach(
}
break;
case 'state':
renamePathInObject(instance.state, oldPath, newPath);
instance.forceUpdate();
switch (fiber.tag) {
case ClassComponent:
case IncompleteClassComponent:
renamePathInObject(instance.state, oldPath, newPath);
instance.forceUpdate();
break;
}
break;
}
}
@@ -7964,6 +7976,7 @@ export function attach(
case 'state':
switch (fiber.tag) {
case ClassComponent:
case IncompleteClassComponent:
setInObject(instance.state, path, value);
instance.forceUpdate();
break;