Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

loading state data properties for dcc.Graph don't disappear #507

Open
@chriddyp

Description

@chriddyp

Currently, the loading state data properties are only updated on render, rather than on plot:

render() {
const {className, id, style, loading_state} = this.props;
return (
<div
key={id}
id={id}
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
style={style}
className={className}
/>
);
}

Since shouldComponentUpdate returns false if the the ID doesn't change, the data properties don't change once they've been added.

shouldComponentUpdate(nextProps) {
return (
this.props.id !== nextProps.id ||
JSON.stringify(this.props.style) !== JSON.stringify(nextProps.style)
);
}

This fixed with two improvements:

  1. Update shouldComponentUpdate with a check for loading_state, letting the render re-render with the new data properties
  2. Incorporate the plot command so that the loading state is updated once the chart finishes drawing.

1 would fix the bug, 2 would be a slight improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dash-type-bugSomething isn't working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions