-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing defining potentially non existent components in the running keyword #2898
Allowing defining potentially non existent components in the running keyword #2898
Conversation
If a component defined in running does not exist, the componentPath in updateComponent will be undefined. Added a check that skips the update if that is the case. Otherwise the dashboard will crash as it will try to perform operations on the undefined object that it cannot perform.
…-existent component in the running keyword.
@@ -334,6 +334,11 @@ function updateComponent(component_id: any, props: any) { | |||
return function (dispatch: any, getState: any) { | |||
const paths = getState().paths; | |||
const componentPath = getPath(paths, component_id); | |||
if (typeof componentPath === 'undefined') { | |||
// Can't find the component that was defined in the running keyword, | |||
// Let's skip the component to prevent the dashboard from crashing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to throw an error unless config.suppress_callback_exceptions=True
. It is in state.config, could refactor line 335 to const {paths,config} = getState();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a check for that and threw an error when suppress_callback_exceptions=False
…hrow error Non-existent running components will now only silently passed if surpress_callback_exceptions=True. Otherwise, an error will be thrown. Note: even if an error is thrown, the callback execution is not stopped. Only the side-update of the running component is ignored.
…g components and not suppressing callback exceptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 Looks good
closes #2897
When using the running keyword in (regular) callbacks, the app crashes if a component is used that does not exist in the layout. Added a check to only continue with component update it the component was found in the dashboard. Full explanation in #2897.
Contributor Checklist
optionals
CHANGELOG.md