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
onLayoutChange is always called twice #1984
Comments
I have the same error in my project. EDITED: I previously have used the The workaround I found is to use the In addition as I needed to save the new position (of the widget) in the currently visible breakpoint I also needed to add the
I hope this helps a bit / with this you can work on fixing your code :) |
@Jonathan-Hofmann Thanks man for saving my day. Having the exact same issue and the layout got overwritten and it is a mess. Your workaround works great! The onLayoutChange callback definitely need some re-work to avoid duplicated calling.. |
yeah, your tips helped me too.
but I still have problems on y position when having elements of different height in grid |
Describe the bug
After updating to v1.4.1, onLayoutChange is always called twice.
My same code works on v1.4.0, but on v1.4.1 my function onLayoutChange is always called twice, first with the correct changes and then again with a revert. This happens both on dragging and resizing.
You can see this happens in the default code sandbox if you change the version to 1.4.1
Your Example Website or App
https://codesandbox.io/s/frosty-stallman-8763h3?file=/src/index.js
Steps to Reproduce the Bug or Issue
Add "onLayoutChange" prop
Change the layout
See the function is called twice
Expected behavior
As a user, I expect onLayoutChange to only be called once per change
react-grid-layout library version
1.4.1
Operating System Version
Linux
Browser
Firefox
Additional context
No response
Screenshots or Videos
No response
The text was updated successfully, but these errors were encountered: