-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiResizableContainer] Initialize after DOM is ready #4447
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4447/ |
I don't know if this is related or not, but I have an issue in my usage of the component where I'm setting an |
actually, I'm not sure wee need this check to render the content of so just removing the check I also do not see any necessity to use resize observer I created a pr to this branch with the clean up thompsongl#14 |
This sound like an unrelated bug, but one that should be
This goes back to a decision I made after seeing that the size of the container is recalculated every time a panel is resized (many times over the course of a panel drag event). The resize observer instead calculates the size of the container 1) once initially and 2) only when the container itself changes sizes or goes from hidden to visible, all of which are much more rare than panel resize events. By eliminating "goes from hidden to visible", it's mostly just a window resize event that would cause a recalculation. Another reason, although not currently in use, is to keep
I agree, it looks like this check can be removed. |
Update: To fix the problem that @cchaos found, we'll need to retain the So, I'd like to move forward without the changes proposed in thompsongl#14. Going to attempt solving |
I'm okay with leaving the subscription to resize and the container size in reducer, but I would insist on removing the check |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4447/ |
jenkins test this Flaky context menu test |
Opened #4453 to track the (mostly unrelated) minSize vs. initialSize issue. No reason to block fixing the lazy load case while we work out the logic necessary. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4447/ |
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.
Changes LGTM; Pulled & tested change locally by verifying bug is reproduced in the modified example when the fix is disabled, and verified the example works as expected with the fix.
Thank you @thompsongl ! ❤️
This reverts commit f8c0fd9.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4447/ |
Summary
Fixes a problem discovered in elastic/kibana#86934.
EuiResizableContainer is initially hidden (
display: none;
) and overlaid with a loading screen while data is loaded. When the data is loaded, the visualization is rendered onto a target DOM element viaref
reference inside the EuiResizablePanel. EuiResizableContainer is mounted at this point but rerenders when it becomes visible and gains calculable size dimensions. That rerender changes/remounts the targetdiv
and alters theref
, effectively disconnecting the visualization from the DOM.The solution is to not initialize EuiResizableContainer until it is visible/has calculable dimensions. There are likely other ways to solve this problem in the implementation (e.g., not using
display: none;
; watching forref
changes), but we have the information readily available in component state to prevent this kind of unnecessary rerender/remount.Docs change is a rudimentary example that will be reverted prior to merging. Comment out the real changes to see the problem. Alternatively, use the linked branch to test in the true Kibana environment.
Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Props have proper autodocs- [ ] Added documentation- [ ] Added or updated jest tests