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

Function loading

dash/dash-renderer/src/reducers/loading.ts:14–44  ·  view source on GitHub ↗
(
    state: LoadingState = {},
    action: LoadingAction
)

Source from the content-addressed store, hash-verified

12};
13
14export default function loading(
15 state: LoadingState = {},
16 action: LoadingAction
17) {
18 switch (action.type) {
19 case 'LOADED':
20 return action.payload.reduce((acc, load) => {
21 const loadPath = [JSON.stringify(load.path)];
22 const prev = pathOr<any>([], loadPath, acc);
23 return assocPath(
24 loadPath,
25 prev.filter(
26 (loading: any) => loading.property !== load.property
27 ),
28 acc
29 );
30 }, state);
31 case 'LOADING':
32 return action.payload.reduce((acc, load) => {
33 const loadPath = [JSON.stringify(load.path)];
34 const prev = pathOr<any>([], loadPath, acc);
35 if (!includes(load, prev)) {
36 // duplicate outputs
37 prev.push(load);
38 }
39 return assocPath(loadPath, prev, acc);
40 }, state);
41 default:
42 return state;
43 }
44}

Callers 1

__executeFunction · 0.90

Calls 3

reduceMethod · 0.80
filterMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…