Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GridStack breaks when updating an element from resize event #3012

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

Open
caiokawasaki opened this issue Apr 11, 2025 · 1 comment
Open

GridStack breaks when updating an element from resize event #3012

caiokawasaki opened this issue Apr 11, 2025 · 1 comment

Comments

@caiokawasaki
Copy link

caiokawasaki commented Apr 11, 2025

Subject of the issue

I'm trying to create a grid where elements have a fixed aspect ratio, I'm successfull but I found a bug when using the resize event.

Your environment

  • Version of gridstack.js - ^11.5.1
  • Browser/OS - Chrome/MacOs

Steps to reproduce

https://jsfiddle.net/b2xwjd6y/

Expected behavior

I need to resize elements keeping the aspec ratio.

If you guys can watch on this video, when the resize event is enabled I got the desired result, it will resize correctly keeping the aspect radio, but it will crash after the resize ending:
https://github.com/user-attachments/assets/07369d42-b56b-4571-a722-03223e37ae19

If you guys can watch on this video, when the resize event is disabled, it will resize without keeping the aspect radio:
https://github.com/user-attachments/assets/32bce07d-bc82-4f02-86f6-021ab328fb1d

@adumesny
Copy link
Member

adumesny commented Apr 11, 2025

your demo is incorrect. you have 9 column but don't include extra.css. then you have grid.update(el, { h: el.gridstackNode }) which is garbage...

also updating an item size as you resize is going to be not well defined. yeah it shouldn't crash, but you shouldn't do it either... could cause inf loop or some weird overlapp since you may put some incorrect values, and it needs to call you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants