(
graphs: any,
paths: any,
layout: any,
options: any
)
| 271 | }; |
| 272 | |
| 273 | export 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); |
no test coverage detected
searching dependent graphs…