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

Function getCallbacksByInput

dash/dash-renderer/src/actions/dependencies_ts.ts:44–100  ·  view source on GitHub ↗
(
    graphs: any,
    paths: any,
    id: any,
    prop: any,
    changeType?: any,
    withPriority = true
)

Source from the content-addressed store, hash-verified

42 `${stringifyId(id)}.${property}`;
43
44export function getCallbacksByInput(
45 graphs: any,
46 paths: any,
47 id: any,
48 prop: any,
49 changeType?: any,
50 withPriority = true
51): ICallback[] {
52 const matches: ICallback[] = [];
53 const idAndProp = combineIdAndProp({id, property: prop});
54
55 if (typeof id === 'string') {
56 // standard id version
57 const callbacks = (graphs.inputMap[id] || {})[prop];
58 if (!callbacks) {
59 return [];
60 }
61
62 callbacks.forEach(
63 addAllResolvedFromOutputs(resolveDeps(), paths, matches)
64 );
65 } else {
66 // wildcard version
67 const _keys = Object.keys(id).sort();
68 const vals = props(_keys, id);
69 const keyStr = _keys.join(',');
70 const patterns: any[] = (graphs.inputPatterns[keyStr] || {})[prop];
71 if (!patterns) {
72 return [];
73 }
74 patterns.forEach(pattern => {
75 if (idMatch(_keys, vals, pattern.values)) {
76 // When a callback's Outputs have no MATCH keys, the
77 // triggering Input's MATCH values are what uniquify each
78 // firing's resolvedId (see addAllResolvedFromOutputs).
79 // Callbacks whose Outputs do carry MATCH keys ignore this
80 // value since the Output pattern drives resolution.
81 const triggerAnyVals = getAnyVals(pattern.values, vals);
82 pattern.callbacks.forEach(
83 addAllResolvedFromOutputs(
84 resolveDeps(_keys, vals, pattern.values),
85 paths,
86 matches,
87 triggerAnyVals
88 )
89 );
90 }
91 });
92 }
93 matches.forEach(match => {
94 match.changedPropIds[idAndProp] = changeType || DIRECT;
95 if (withPriority) {
96 match.priority = getPriority(graphs, paths, match);
97 }
98 });
99 return matches;
100}
101

Callers 7

handleOneIdFunction · 0.90
getInputHistoryStateFunction · 0.90
getPriorityFunction · 0.85
includeObserversFunction · 0.85

Calls 8

idMatchFunction · 0.90
getAnyValsFunction · 0.90
combineIdAndPropFunction · 0.85
resolveDepsFunction · 0.85
getPriorityFunction · 0.85
keysMethod · 0.80
sortMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…