-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Incorrect order of items if a height of one item has been changed manually #2206
Comments
hey thanks for filling it and fixing it ! let me reproduce it locally and see your fix, because we do want to re-use the collision node , but maybe not for the next nested level down... |
Hey, Alain. My solution looks like a hack. When i was debugging the problem i found out that the list of collisions is fixed from the last item to the first, but in the line First of all I tried to change this line to take the last item in the list of collisions. Logically this approach should have fixed the problem but due to some unknown logic (i have not debugged) it fixed only the position of the first item and as far as i remember it broke the position of the last. Therefore i decided to change the I am sure almost on 100% that there is an another way to fix the problem but this was a quick fix. And you are as a maintainer know better what should have done. By the way the working example from the screenshots above can be found in that commit |
can you post a jsfiddle (or similar) TS example like https://jsfiddle.net/adumesny/jqhkry7g showing the issue (as bug request mention) without React ? then I can add it to the automated tests... If it works by user resizing but not by |
Please let me know if it is good example - https://jsfiddle.net/sergeifomin/7x9apehq/ |
FYI,calling Update: this is actually hard to fix the right way (though it was a sorting issue, but it's not) as both cases update() is called on the same item 1, BUT in load() we do batchUpdate() so the collision is different which it shouldn't. not gonna fix this right now... |
that's not the problem (only item 1 does anything) - and there's a lot more to update than just position... any field |
Yes you are right samePos checks only position |
fixed in next release. don't forget to donate if you find this lib useful! |
Subject of the issue
In case if you are changing a height of one item by changing the
h
property for instance by changing a state in react app you can face an incorrect order of items, i.e. the item standing next to the changed item is moved to the end of the list.Your environment
I managed to fix it locally by changing the third parameter of the
_fixCollisions
method on the 671 line of thegridstack-engine.ts
file fromcollide
toundefined
forcing it to define collisions once again and to start moving items from the last to the first in the listI can send a PR if it is a bug and not the feature
The text was updated successfully, but these errors were encountered: