Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
added, removed, change
or combination if adding a node require also to change its (x,y) for example(we use to always get 'change' duplicated callback)
batchUpdate()
before calling a bunch ofaddWidget()
and get a single event callback (more efficient).Note: moving items in float=false will still sometimes have change CB with all items, not just those that moved. this is due to how _fixCollisions() does this
if (!this.float && !hasLocked) { nn = {x: 0, y: node.y, width: this.column, height: node.height}; }
causing all items to temporarly move. I don't claim to understand that code yet...
n._dirty = n._origY != newY;
(the difference in callbacks noise of 0.5.5 vs this code is UDGE for serialize.html as an example)
Test
best way to test how much better the callback noise is vs before is to run the local
serialize.html copy with these changes. First use
<script src="https://cdn.jsdelivr.net/npm/gridstack@0.5.5/dist/gridstack.all.js"></script>
then the fixed lib code.
Checklist
yarn test
)