bvaughn / react-resizable-panels

https://react-resizable-panels.vercel.app/
MIT License
3.87k stars 135 forks source link

Collapsed state resets when new values are provided to collapsedSize/minSize #273

Closed viveleroi closed 8 months ago

viveleroi commented 8 months ago

v1.0.9 added support for detecting changes to collapsedSize, however this appears to be resetting the collapsed state.

CodeSandbox

This demo uses window width to divide a fixed-pixel value into a percentage, since react-resizable-panels takes percentages. I'm using a hook useWindowSize from the usehooks-ts library. Outside of always giving the initial window size as 0 (which I've reported, and counter-acted here) I've confirmed the min and collapsed sizes are being calculated/rounded as expected.

  1. Open the demo in a new tab/window
  2. Collapse the left panel
  3. Minimize your browser window and start resizing in any direction
  4. Notice the left panel expands (aka reverts from being collapsed)

Related to #266

bvaughn commented 8 months ago

I'm not sure I understand how to repro this bug. Any chance I could get you to record a Replay of it for me?

viveleroi commented 8 months ago
  1. Maximize your browser window
  2. Go to https://m3l8c5.csb.app/
  3. Collapse the left panel if it's not already
  4. Minimize your browser window, the left panel should still be collapsed
  5. Grab the right edge of your browser window and resize it left or right
  6. The left panel jumps back to an-uncollapsed state

I'll have to look into that software but am on a work PC and there's some red tape

bvaughn commented 8 months ago

Got it. I recorded a Replay of it here: https://app.replay.io/recording/93348660-1153-44cb-9a3e-77b13ca40737

Going to look into it now.

bvaughn commented 8 months ago

Fixed in e0ae667; released in react-resizable-panels@1.0.10


❤️ → ☕ givebrian.coffee