-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Reactively changing splitter size causes errors in solid in 1.0 #2277
Comments
Whoops you're right - on my actual code it doesn't occur on 0.82.2, but on the reproduction in stackblitz it does, there must be some extra thing cancelling out the issue on my actual code. Thanks! Looking forward to completing the migration once this is fixed :) |
Wait actually I was wrong in my previous comment - on 0.82.2 in the stackblitz (current state), If you follow the reproduction instructions there is no issue. We only hit the |
@segunadebayo do you know when you will get to fixing this issue (and the related #2261 and #2109 )? As my above comment says, this isn't actually a duplicate, this behavior is a regression from 0.82.2 and is preventing us from upgrading to 1.0. |
Temp. solution for this is to call the createEffect(() => {
if (buttonStatusGetter()) {
untrack(() => {
queueMicrotask(() => {
props.api.setSize("a", 30)
props.api.setSize("b", 70)
})
})
}
}) Love the idea of |
Pushed a fix for this. I will get to the initial jumping issue pretty soon. |
🐛 Bug report
In solid-js, calling
api.setSize
in acreateEffect
leads to anerror, even if we change the sizes an order where this shouldn't happen.
This did not happen on 0.82.2, I encountered this while doing the 1.0 migration.
💥 Steps to reproduce
ResizeButton
, we first reduce the size ofa
, and only then increase the size ofb
open preview in new tab
button so we can easily see console errorsresize
Uncaught Error: Total size of panels cannot be greater than 100
in console6 get the error again if we try to resize after this point
💻 Link to reproduction
https://stackblitz.com/edit/sb1-whqjvvup?file=src%2FApp.tsx
🧐 Expected behavior
For the reisze to happen and not through
🧭 Possible Solution
I'm not sure what the correct under-the-hood solutions here would be, but there are two things that would improve this area imo:
setSizes
function that lets you save multiple sizes at once, so we don't have to reason about the order thatsetSize
calls have to happen to not trigger the error.getSize
function for easier runtime debugging of what's going on🌍 System information
📝 Additional information
There is another (probably unrelated) issue - when dragging the resize separator, if it's close to the side it'll jump initially on the start of the drag, see video produced on the reproduction link:
Screen.Recording.2025-02-24.at.12.54.37.mov
The text was updated successfully, but these errors were encountered: