Consistent handling of work tags for rename, delete, and overriding state (#35740)
Co-authored-by: Ruslan Lesiutin <28902667+hoxyq@users.noreply.github.com>
Sebastian "Sebbie" Silbermann committed
Feb 10, 2026 at 16:35 UTC
70890e7c58abccef35a6498f7ee702d608be79d6
1 file changed
+17
-4
packages/react-devtools-shared/src/backend/fiber/renderer.js
+17
-4
@@ -6859,6 +6859,8 @@ export function attach(
6859
6860
// TODO Show custom UI for Cache like we do for Suspense
6861
// For now, just hide state data entirely since it's not meant to be inspected.
6862
+ // Make sure delete, rename, and override of state handles all tags for which
6863
+ // we show state.
6864
const showState =
6865
tag === ClassComponent || tag === IncompleteClassComponent;
6866
@@ -7815,8 +7817,13 @@ export function attach(
7817
}
7818
break;
7819
case 'state':
7818
- deletePathInObject(instance.state, path);
7819
- instance.forceUpdate();
7820
+ switch (fiber.tag) {
7821
+ case ClassComponent:
7822
+ case IncompleteClassComponent:
7823
+ deletePathInObject(instance.state, path);
7824
+ instance.forceUpdate();
7825
+ break;
7826
+ }
7827
break;
7828
}
7829
}
@@ -7893,8 +7900,13 @@ export function attach(
7900
}
7901
break;
7902
case 'state':
7896
- renamePathInObject(instance.state, oldPath, newPath);
7897
- instance.forceUpdate();
7903
+ switch (fiber.tag) {
7904
+ case ClassComponent:
7905
+ case IncompleteClassComponent:
7906
+ renamePathInObject(instance.state, oldPath, newPath);
7907
+ instance.forceUpdate();
7908
+ break;
7909
+ }
7910
break;
7911
}
7912
}
@@ -7964,6 +7976,7 @@ export function attach(
7976
case 'state':
7977
switch (fiber.tag) {
7978
case ClassComponent:
7979
+ case IncompleteClassComponent:
7980
setInObject(instance.state, path, value);
7981
instance.forceUpdate();
7982
break;