mirror of
https://github.com/facebook/react.git
synced 2026-02-21 19:31:52 +00:00
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:
committed by
GitHub
parent
f23aa1d9f5
commit
70890e7c58
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user