(
[storeProperty, newRawValue]: debug.InspectorUpdateMap['store'],
storeNodeMap: decode.StoreNodeMap,
)
| 103 | } |
| 104 | |
| 105 | function updateStore( |
| 106 | [storeProperty, newRawValue]: debug.InspectorUpdateMap['store'], |
| 107 | storeNodeMap: decode.StoreNodeMap, |
| 108 | ): void { |
| 109 | const [storeNodeId, property] = splitOnColon(storeProperty) |
| 110 | const store = storeNodeMap.get(storeNodeId) |
| 111 | if (!store) throw `updateStore: store node (${storeNodeId}) not found` |
| 112 | |
| 113 | const value = store.value |
| 114 | if (!value) throw `updateStore: store node (${storeNodeId}) has no value` |
| 115 | |
| 116 | const newValue = (Array.isArray(value) ? value.slice() : {...value}) as {[key: string]: any} |
| 117 | |
| 118 | if (newRawValue === null) { |
| 119 | delete newValue[property] |
| 120 | } else if (typeof newRawValue === 'number') { |
| 121 | if (Array.isArray(value)) value.length = newRawValue |
| 122 | else throw `updateStore: store node (${storeNodeId}) is not an array` |
| 123 | } else { |
| 124 | newValue[property] = decode.decodeValue(newRawValue, newValue[property], storeNodeMap) |
| 125 | } |
| 126 | store.setValue(newValue) |
| 127 | } |
| 128 | |
| 129 | const NULL_STATE = { |
| 130 | name: null, |
no test coverage detected
searching dependent graphs…