Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f7764d9

Browse files
committed
moving location of component test
1 parent 973a23c commit f7764d9

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

dash/dash-renderer/src/actions/callbacks.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,7 @@ function sideUpdate(outputs: SideUpdateOutput, cb: ICallbackPayload) {
421421
const state = getState();
422422

423423
const componentPath = getPath(state.paths, id);
424-
if (!componentPath) {
425-
// Component doesn't exist, doesn't matter just allow the
426-
// callback to continue.
427-
return;
428-
}
424+
429425
const oldComponent = getComponentLayout(componentPath, state);
430426

431427
const oldProps = oldComponent?.props || {};
@@ -434,6 +430,12 @@ function sideUpdate(outputs: SideUpdateOutput, cb: ICallbackPayload) {
434430

435431
dispatch(updateComponent(id, patchedProps, cb));
436432

433+
if (!componentPath) {
434+
// Component doesn't exist, doesn't matter just allow the
435+
// callback to continue.
436+
return;
437+
}
438+
437439
dispatch(
438440
setPaths(
439441
computePaths(

dash/dash-renderer/src/utils/clientsideFunctions.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ function set_props(
2525
componentPath = idOrPath;
2626
}
2727
const oldComponent = getComponentLayout(componentPath, state);
28-
if (!oldComponent) {
29-
console.error(
30-
`Could not find component with id or path: ${idOrPath}`
31-
);
32-
return;
33-
}
28+
3429
// Handle any patch props
35-
props = parsePatchProps(props, oldComponent.props);
30+
props = parsePatchProps(props, oldComponent?.props || {});
3631

32+
// Update the props
3733
dispatch(
3834
updateProps({
3935
props,
@@ -43,6 +39,12 @@ function set_props(
4339
);
4440
dispatch(notifyObservers({id: idOrPath, props}));
4541

42+
if (!oldComponent) {
43+
console.error(
44+
`Could not find component with id or path: ${idOrPath}`
45+
);
46+
return;
47+
}
4648

4749
dispatch(
4850
setPaths(

0 commit comments

Comments
 (0)