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

Function selectDashProps

dash/dash-renderer/src/wrapper/selectors.ts:84–107  ·  view source on GitHub ↗
(componentPath: DashLayoutPath)

Source from the content-addressed store, hash-verified

82
83export const selectDashProps =
84 (componentPath: DashLayoutPath) =>
85 (state: any): SelectDashProps => {
86 const c = getComponentLayout(componentPath, state);
87 // Layout hashes records the number of times a path has been updated.
88 // sum with the parents hash (match without the last ']') to get the real hash
89 // Then it can be easily compared without having to compare the props.
90 const strPath = stringifyPath(componentPath);
91
92 let hash;
93 if (checkDashChildrenUpdate(c)) {
94 hash = determineChangedProps(state, strPath);
95 } else {
96 hash = state.layoutHashes[strPath];
97 }
98 let h = 0;
99 let changedProps: object = {};
100 let renderType = '';
101 if (hash) {
102 h = hash['hash'];
103 changedProps = hash['changedProps'];
104 renderType = hash['renderType'];
105 }
106 return [c, c?.props, h, changedProps, renderType];
107 };
108
109export function selectDashPropsEqualityFn(
110 [_, __, hash]: SelectDashProps,

Callers 1

DashWrapperFunction · 0.90

Calls 4

getComponentLayoutFunction · 0.90
stringifyPathFunction · 0.90
checkDashChildrenUpdateFunction · 0.90
determineChangedPropsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…