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

Function getLayoutCallbacks

dash/dash-renderer/src/actions/dependencies_ts.ts:273–351  ·  view source on GitHub ↗
(
    graphs: any,
    paths: any,
    layout: any,
    options: any
)

Source from the content-addressed store, hash-verified

271};
272
273export const getLayoutCallbacks = (
274 graphs: any,
275 paths: any,
276 layout: any,
277 options: any
278): ICallback[] => {
279 let exclusions: string[] = [];
280 let callbacks = getUnfilteredLayoutCallbacks(
281 graphs,
282 paths,
283 layout,
284 options
285 );
286
287 /*
288 Remove from the initial callbacks those that are left with only excluded inputs.
289
290 Exclusion of inputs happens when:
291 - an input is missing
292 - an input in the initial callback chain depends only on excluded inputs
293
294 Further exclusion might happen after callbacks return with:
295 - PreventUpdate
296 - no_update
297 */
298 while (true) {
299 // Find callbacks for which all inputs are missing or in the exclusions
300 const [included, excluded] = partition(
301 ({callback: {inputs}, getInputs}) =>
302 all(isMultiValued, inputs) ||
303 !isEmpty(
304 difference(
305 map(combineIdAndProp, flatten(getInputs(paths))),
306 exclusions
307 )
308 ),
309 callbacks
310 );
311
312 // If there's no additional exclusions, break loop - callbacks have been cleaned
313 if (!excluded.length) {
314 break;
315 }
316
317 callbacks = included;
318
319 // update exclusions with all additional excluded outputs
320 exclusions = concat(
321 exclusions,
322 map(
323 combineIdAndProp,
324 flatten(map(({getOutputs}) => getOutputs(paths), excluded))
325 )
326 );
327 }
328
329 if (options.filterRoot) {
330 let rootId = path(['props', 'id'], layout);

Callers 2

triggerDefaultStateFunction · 0.90
handlePathsFunction · 0.90

Calls 6

stringifyIdFunction · 0.90
isEmptyFunction · 0.85
filterMethod · 0.80
reduceMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…