Skip to content
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

fix(ChartStatus): render complete if same parent size is dispatched #2534

Conversation

markov00
Copy link
Member

Summary

A PR in Kibana identified a bug in our current code (and probably also in the ResizeObserver API). This PR showed that the ResizeObserver can dispatch the same witdh/height/left/top values under certain circumstances (not really clear from the PR).
In code we don't have a check for this case thus a duplicated updateParentDimension action can be dispatched causing the chart to remain in a wrong state: the renderedComplete:false but the chart still rendered on the screen. The configured chart renderer doesn't get triggered because the parentDimension in effect is not changed, thus the render count doesn't increase and no dispatch to onRenderCompleteis issued, causing a wrong ChartStatus to be reported.

The fix just trigger a UPDATE_PARENT_DIMENSION state change only if the dimensions are different.

Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Code changes LGTM, tested on Storybook with no issues.

@markov00 markov00 merged commit c3aba88 into elastic:main Oct 2, 2024
14 checks passed
nickofthyme pushed a commit that referenced this pull request Oct 3, 2024
## [67.0.1](v67.0.0...v67.0.1) (2024-10-03)

### Bug Fixes

* **ChartStatus:** render complete if same parent size is dispatched ([#2534](#2534)) ([c3aba88](c3aba88))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants