-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
.isCollapsed() seems very unreliable? #325
Comments
Please share a repro. It's really hard to help trouble shoot issues where there's no shared code. I suggest you also check out #265 and #264 since they seem to be related. Generally speaking, I have decided not to support pixel based constraints, so what you're doing might just be out of scope for this library, but I can't tell without seeing a repro. |
Here's a repro: https://codesandbox.io/p/sandbox/react-resizable-panels-forked-pydfkc As you can see the left panel (using the minSize-hook to generate the value for collapsedZise) isn't expanding, but the right (which uses an integer value) can indeed expand. |
I recorded a Replay of the repro you provided, and I can see where the I try to account for potential precision issues within the library's own methods, but this case kind of falls between the cracks a bit, because I guess I could account for this by using a fuzzy comparison in the is-collapsed/is-expanded helper methods. |
2b0ff1a should guard against high precision values from code like the example you shared. It has been released in version 2.0.14. ❤️ → ☕ givebrian.coffee |
Thanks a lot @bvaughn! 🙏 I did notice that the props onCollapse and onExpand stopped working now 🤷♂️ |
The number of edge cases with high precision values are part of the reason I chose not to support pixel based constraints. 2.0.15 should fix the callback issue. If you uncover anything else though, you'll need to submit a PR. I don't think I have the mental energy to try to support this use case 😅 Thanks for understanding. ❤️ → ☕ givebrian.coffee |
Think I accidentally re-opened this one so I'm going to close it now. We can talk more on a new issue if anything else crops up. |
I'm calculating the
collapsedSize
of a panel to enable px-based values, and running into some issues related to that. It seems, when using this hook to supply a value tocollapsedSize
.isCollapsed()
is always returningfalse
. I can run.collapse()
successfully on a ref of the panel, but then.isCollapsed()
returns false.First my guess was that the number had too many decimals (there seems to be an issue with more than 10 decimals), but
toFixed()
is not solving my OG issue.So then I was guessing - if the fact that my hook returns one number on first render, and then another on second, could be the issue? This seems more likely.
I will continue testing on my end, but would be nice to hear if anyone has any ideas on what might be wrong?
(v2.0.13)
The text was updated successfully, but these errors were encountered: