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

Function replacePMC

dash/dash-renderer/src/actions/patternMatching.ts:58–91  ·  view source on GitHub ↗
(
    id: any,
    cb: ICallbackPayload,
    index: number,
    getState: any
)

Source from the content-addressed store, hash-verified

56 * @returns List of replaced ids.
57 */
58export function replacePMC(
59 id: any,
60 cb: ICallbackPayload,
61 index: number,
62 getState: any
63): any[] {
64 let extras: any = [];
65 const replaced: any = {};
66 toPairs(id).forEach(([key, value]) => {
67 if (extras.length) {
68 // All done.
69 return;
70 }
71 if (Array.isArray(value)) {
72 const triggerValue = (cb.parsedChangedPropsIds[index] ||
73 cb.parsedChangedPropsIds[0])[key];
74 if (value.includes('MATCH')) {
75 replaced[key] = triggerValue;
76 } else if (value.includes('ALL')) {
77 extras = getAllPMCIds(id, getState(), key);
78 } else if (value.includes('ALLSMALLER')) {
79 extras = getAllPMCIds(id, getState(), key).filter(
80 (obj: any) => obj[key] < triggerValue
81 );
82 }
83 } else {
84 replaced[key] = value;
85 }
86 });
87 if (extras.length) {
88 return extras;
89 }
90 return [replaced];
91}

Callers 1

sideUpdateFunction · 0.90

Calls 3

getAllPMCIdsFunction · 0.85
getStateFunction · 0.85
filterMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…