-
Notifications
You must be signed in to change notification settings - Fork 121
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: remove double rendering #693
fix: remove double rendering #693
Conversation
Use only the ResizeObseerver to handle chart sizing at the initialization. fix elastic#690
Codecov Report
@@ Coverage Diff @@
## master #693 +/- ##
==========================================
+ Coverage 73.13% 75.13% +1.99%
==========================================
Files 271 271
Lines 8784 8802 +18
Branches 1747 1735 -12
==========================================
+ Hits 6424 6613 +189
+ Misses 2309 2132 -177
- Partials 51 57 +6
Continue to review full report at Codecov.
|
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.
Thanks @markov00 the PR is effective in that there's no double rendering, I checked it in storybook mode and playground mode.
As a side effect, the way eg. the viewModel
is invoked in partition charts (and maybe in Cartesians) seems to have changed a bit, at least when tested via the playground:
- viewmodel generation (
viewModel.ts
main function) is invoked twice (tbh not sure ifmaster
does it or not); the first invocation have zeroish width/height so it bails (and the resulting identity viewmodel - emptiness - causes that there's no rendering) - however, now the first invocation not only doesn't have width/height; it also doesn't seem to have the chart spec data
While point 2 is not apparent - because it bails anyway due to zero width/height - I'm mentioning this as you might know of some unintended consequences to this. Also, it's unrelated to the PR but ideally there wouldn't be an initial round of rendering with zero dimensions but I'm not sure if it's accidental and we don't care about the dual pass, or there's some hard async problem for which it's the optimal or developer time efficient solution
Approving the PR as it addresses the issue, and leaving it to your judgment if the apparently different zero-width/height invocation is cause for concern or not; @nickofthyme I see you've made commits in this part of the file, maybe know of something?
Jenkins test this |
@@ -36,6 +36,8 @@ interface ResizerDispatchProps { | |||
|
|||
type ResizerProps = ResizerStateProps & ResizerDispatchProps; | |||
|
|||
const DEFAULT_RESIZE_DEBOUNCE = 200; | |||
|
|||
class Resizer extends React.Component<ResizerProps> { | |||
private initialResizeComplete = false; | |||
private containerRef: RefObject<HTMLDivElement>; |
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.
unrelated but could be changed when this file needs an update, containerRef
could be read only
…/elastic-charts into 2020_06_01-fix_double_rendering
@nickofthyme fixed 2b0c472 |
@monfera fixed here 72b6c36 |
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.
LGTM, seems like the connection between the legend unit test needs to be updated. But the legend stories appear to render fine.
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.
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.
Great work, I also see a single rendering - and a single change that doubles performance across the board 🎉
# [19.5.0](v19.4.1...v19.5.0) (2020-06-15) ### Bug Fixes * **tooltip:** show true opaque colors in tooltips ([#629](#629)) ([23290be](23290be)), closes [#628](#628) * path of stacked area series with missing values ([#703](#703)) ([2541180](2541180)) * remove double rendering ([#693](#693)) ([ebf2748](ebf2748)), closes [#690](#690) ### Features * **partition:** add 4.5 contrast for text in partition slices ([#608](#608)) ([eded2ac](eded2ac)), closes [#606](#606) * add screenshot functions to partition/goal ([#697](#697)) ([5581c3c](5581c3c))
🎉 This PR is included in version 19.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [19.5.0](elastic/elastic-charts@v19.4.1...v19.5.0) (2020-06-15) ### Bug Fixes * **tooltip:** show true opaque colors in tooltips ([opensearch-project#629](elastic/elastic-charts#629)) ([323b325](elastic/elastic-charts@323b325)), closes [opensearch-project#628](elastic/elastic-charts#628) * path of stacked area series with missing values ([opensearch-project#703](elastic/elastic-charts#703)) ([93f063f](elastic/elastic-charts@93f063f)) * remove double rendering ([#693](elastic/elastic-charts#693)) ([1a9bbb9](elastic/elastic-charts@1a9bbb9)), closes [#690](elastic/elastic-charts#690) ### Features * **partition:** add 4.5 contrast for text in partition slices ([opensearch-project#608](elastic/elastic-charts#608)) ([59d6d49](elastic/elastic-charts@59d6d49)), closes [opensearch-project#606](elastic/elastic-charts#606) * add screenshot functions to partition/goal ([opensearch-project#697](elastic/elastic-charts#697)) ([6d2ff64](elastic/elastic-charts@6d2ff64))
Summary
The
chart_resizer
component sends the first action on mount and then activate the resize observer that subsequentially sends another chart size update.The PR fixes this behavior letting the ResizeObserver doing his job.
fix #690