MCPcopy Index your code
hub / github.com/plotly/dash / modProp

Function modProp

dash/dash-renderer/src/persistence.js:374–393  ·  view source on GitHub ↗
(key, storage, element, props, persistedProp, update, undo)

Source from the content-addressed store, hash-verified

372
373const UNDO = true;
374function 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
395function persistenceMods(layout, component, path, dispatch) {
396 const {

Callers 2

persistenceModsFunction · 0.85
prunePersistenceFunction · 0.85

Calls 5

getTransformFunction · 0.85
hasItemMethod · 0.45
getItemMethod · 0.45
applyMethod · 0.45
removeItemMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…