-
Notifications
You must be signed in to change notification settings - Fork 56
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
[Bug] there is an obvious flicker when the defaultSizes contains zero on first render #537
Comments
Ahhh, I notice there is a PR (#526) which can solve this problem. |
#526 has been merged and released as v1.18.0. Let me know if it helps 👍 |
Hi @johnwalley,
Well, after some test, the #526 can resolve the problem what I found in storybook. But unfortunately, the same problem happens in my personal project. I made a demo, it can reproduce the flicker. https://codesandbox.io/s/thirsty-wind-bzqg9h?file=/src/App.tsx After some test and debug, I found some unwanted behaviors.
|
Thanks for the fast, detailed feedback. I'll try to tackle this soon. |
Now we can use
For this one, I delete the below commented code in this place. Then everything works fine.
useResizeObserver({
ref: containerRef,
onResize: ({ width, height }) => {
if (width && height) {
splitViewRef.current?.layout(vertical ? height : width);
layoutService.current.setSize(vertical ? height : width);
// setDimensionsInitialized(true);
}
},
});
useIsomorphicLayoutEffect(() => {
// if (!dimensionsInitialized) {
// const { height, width } = containerRef.current.getBoundingClientRect();
// splitViewRef.current?.layout(vertical ? height : width);
// layoutService.current.setSize(vertical ? height : width);
setDimensionsInitialized(true);
// }
}, [
// dimensionsInitialized,
// vertical
]); |
See the gif, the defaultSizes is
[0, 10000]
. I refresh page three times. The flicker occurs twice.The text was updated successfully, but these errors were encountered: