(
type: 'context' | 'hooks' | 'props' | 'state',
id: number,
hookID: ?number,
path: Array<string | number>,
)
| 971 | } |
| 972 | |
| 973 | function deletePath( |
| 974 | type: 'context' | 'hooks' | 'props' | 'state', |
| 975 | id: number, |
| 976 | hookID: ?number, |
| 977 | path: Array<string | number>, |
| 978 | ): void { |
| 979 | const internalInstance = idToInternalInstanceMap.get(id); |
| 980 | if (internalInstance != null) { |
| 981 | const publicInstance = internalInstance._instance; |
| 982 | if (publicInstance != null) { |
| 983 | switch (type) { |
| 984 | case 'context': |
| 985 | deletePathInObject(publicInstance.context, path); |
| 986 | forceUpdate(publicInstance); |
| 987 | break; |
| 988 | case 'hooks': |
| 989 | throw new Error('Hooks not supported by this renderer'); |
| 990 | case 'props': |
| 991 | const element = internalInstance._currentElement; |
| 992 | internalInstance._currentElement = { |
| 993 | ...element, |
| 994 | props: copyWithDelete(element.props, path), |
| 995 | }; |
| 996 | forceUpdate(publicInstance); |
| 997 | break; |
| 998 | case 'state': |
| 999 | deletePathInObject(publicInstance.state, path); |
| 1000 | forceUpdate(publicInstance); |
| 1001 | break; |
| 1002 | } |
| 1003 | } |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | function renamePath( |
| 1008 | type: 'context' | 'hooks' | 'props' | 'state', |
nothing calls this directly
no test coverage detected