MCPcopy
hub / github.com/plotly/dash / persistenceMods

Function persistenceMods

dash/dash-renderer/src/persistence.js:395–454  ·  view source on GitHub ↗
(layout, component, path, dispatch)

Source from the content-addressed store, hash-verified

393}
394
395function persistenceMods(layout, component, path, dispatch) {
396 const {
397 canPersist,
398 id,
399 props,
400 element,
401 persistence,
402 persisted_props,
403 persistence_type
404 } = getProps(component);
405
406 let layoutOut = layout;
407 if (canPersist && persistence) {
408 const storage = getStore(persistence_type, dispatch);
409 const update = {};
410 forEach(
411 persistedProp =>
412 modProp(
413 getValsKey(id, persistedProp, persistence),
414 storage,
415 element,
416 props,
417 persistedProp,
418 update
419 ),
420 persisted_props
421 );
422
423 for (const propName in update) {
424 layoutOut = set(
425 lensPath(path.concat('props', propName)),
426 update[propName],
427 layoutOut
428 );
429 }
430 }
431
432 // recurse inward
433 const {children} = props;
434 if (Array.isArray(children)) {
435 children.forEach((child, i) => {
436 if (type(child) === 'Object' && child.props) {
437 layoutOut = persistenceMods(
438 layoutOut,
439 child,
440 path.concat('props', 'children', i),
441 dispatch
442 );
443 }
444 });
445 } else if (type(children) === 'Object' && children.props) {
446 layoutOut = persistenceMods(
447 layoutOut,
448 children,
449 path.concat('props', 'children'),
450 dispatch
451 );
452 }

Callers 1

applyPersistenceFunction · 0.85

Calls 5

getStoreFunction · 0.85
modPropFunction · 0.85
getValsKeyFunction · 0.85
getPropsFunction · 0.70
setFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…