-
Notifications
You must be signed in to change notification settings - Fork 9
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 resizable panel bug #1125
Fix resizable panel bug #1125
Conversation
//Update previous lengthPx | ||
let previousId = id - 1; | ||
let previousContextEl = this.listPanelContext.get(previousId); | ||
if ( | ||
previousContextEl !== undefined && | ||
previousContextEl.defaultLengthFraction && | ||
this.panelGroupLengthPx | ||
) { | ||
previousContextEl.lengthPx = | ||
previousContextEl.defaultLengthFraction * this.panelGroupLengthPx; | ||
} |
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.
I sketched this out as the solution to work.
The issue here is when you add a panel, the last remaining panel which stayed but didn get unregistered will have panelGroupLengthPx = <the entire width of panel group size>
-- the file tree. This lengthPx essentially becomes stale when you register a new panel -- hence, the screen becomes warped (bigger) in the left-panel
@@ -196,7 +196,6 @@ export default class ResizablePanelGroup extends Component<Signature> { | |||
nextPanelEl?: HTMLElement | null; | |||
prevPanelEl?: HTMLElement | null; | |||
} | null = null; | |||
panelRatios: number[] = []; |
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.
Removing this property could potentially bring back this issue. My purpose made this property is to cache the ratio length of all panels in a panel container/group before the container/browser window is being resized. When resizing the browser window, the size of the panels will be updated but with random ratio, then we will call onContainerResize
to recalculate the size of the panels using the cache in the panelRatio
. So if you use getter for the panelRatios
and calculate the panelRatios
from current length of the panels, it might use the length of panels that is updated randomly because the resizing action.
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.
Confirmed this is an issue that comes back
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.
Ahhh I know what you are trying to do. this.panelRatios is not eagerly recalculated (its kind of a checkpoint)
- panelRatios should be only calculated when the number of panels have changed (registering & unregistering)
- if we resize the window, the panelRatios should be cached
My change has an issue because I am recalculating after ANY container resize while number of panels are unchanging
This reverts commit 94b01d1.
b16ee51
to
38b6d90
Compare
I need to spell it out with data. 2 panels
1 panel (unregistered 1)
2 panels (registered 1)
3 panels (registered 1)
Expectation
|
Closing in favor of #1148 |
Screen.Recording.2024-03-28.at.15.27.33.mov