-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Bug description
If you change the value of a panel's collapsedSize property, it doesn't do change its behaviour. It always uses the initial value.
Given that usePanelContext().collapsedSize is an accessor, it implies that the intention is that the value can change, which is what makes me believe this is a bug rather than intended behavior. Indeed, the accessor does pick up the new prop value, and collapsed changes to false when the collapsedSize is different to the original (see repro).
Reproduction Link
https://stackblitz.com/edit/corvu-69tnjqxd?file=src%2FApp.tsx
Reproduction Steps
- Click on "Toggle Collapsed Size"
- Drag the handle left to collapse the left panel
- Observe that it collapses to size 0.2 (the initial
collapsedSize) instead of 0.3 and that is says "Collapsed: no"
Expected behavior
If not currently collapsed: changing collapsedSize should do nothing, until the panel is collapsed, at which point it should use the new value.
If already collapsed: changing collapsedSize should immediately change the size of the panel.
Additional context
This issue is specifically about collapsedSize because my use-case requires it,
but I suspect there are probably similar issues for other properties that the root doesn't get notified of changes to.
corvu/packages/resizable/src/Panel.tsx
Lines 179 to 191 in ff79bca
| const instance = untrack(() => { | |
| return _context.registerPanel({ | |
| id: localProps.panelId, | |
| element, | |
| initialSize: localProps.initialSize, | |
| minSize: localProps.minSize, | |
| maxSize: localProps.maxSize, | |
| collapsible: localProps.collapsible, | |
| collapsedSize: localProps.collapsedSize, | |
| collapseThreshold: localProps.collapseThreshold, | |
| onResize: localProps.onResize, | |
| }) | |
| }) |