(key, storage, element, props, persistedProp, update, undo)
| 372 | |
| 373 | const UNDO = true; |
| 374 | function modProp(key, storage, element, props, persistedProp, update, undo) { |
| 375 | if (storage.hasItem(key)) { |
| 376 | const [newVal, originalVal] = storage.getItem(key); |
| 377 | const fromVal = undo ? newVal : originalVal; |
| 378 | const toVal = undo ? originalVal : newVal; |
| 379 | const [propName, propPart] = persistedProp.split('.'); |
| 380 | const transform = getTransform(element, propName, propPart); |
| 381 | |
| 382 | if (equals(fromVal, transform.extract(props[propName]))) { |
| 383 | update[propName] = transform.apply( |
| 384 | toVal, |
| 385 | propName in update ? update[propName] : props[propName] |
| 386 | ); |
| 387 | } else { |
| 388 | // clear this saved edit - we've started with the wrong |
| 389 | // value for this persistence ID |
| 390 | storage.removeItem(key); |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | function persistenceMods(layout, component, path, dispatch) { |
| 396 | const { |
no test coverage detected
searching dependent graphs…