fix: Deephaven express chart title does not update dynamically#386
Merged
mattrunyon merged 2 commits intodeephaven:mainfrom Mar 26, 2024
Merged
fix: Deephaven express chart title does not update dynamically#386mattrunyon merged 2 commits intodeephaven:mainfrom
mattrunyon merged 2 commits intodeephaven:mainfrom
Conversation
mofojed
previously approved these changes
Mar 23, 2024
| const { fetch } = props; | ||
| const containerRef = useRef<HTMLDivElement>(null); | ||
| const [model, setModel] = useState<PlotlyExpressChartModel>(); | ||
| const [widgetRevision, setWidgetRevision] = useState(0); // Used to force a clean chart state on widget change |
Member
There was a problem hiding this comment.
Do we not get a descriptor in props as well? Pattern I've used elsewhere is memoize on the descriptor to generate a shortid for the element.
Though this seems fine.
Collaborator
Author
There was a problem hiding this comment.
In the types we only have fetch in WidgetComponentProps. The panel gets the metadata descriptor, but when it's used in dh.ui, the metadata is for the dh.ui widget, not the plotly widget
Collaborator
Author
|
Removed from the panel version because it was failing CI, but working locally. I checked and |
mofojed
approved these changes
Mar 26, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #377
The issue was the widget changing and thus the model changing, but the
Chartcomponent was not resetting.Chartputs the model layout into its state, so it wasn't updating when the model changed. This could also be fixed inChart, but this is the simplest fix for the dh.ui scenario in the ticket.This does not fix a scenario where deephaven-express sends a new title (no widget change) as part of an update as
Chartwill still keep its layout over the model's layout in that case. AFAIK there's currently no way to do this though