Skip to content

Conversation

@galizhur
Copy link
Contributor

If you call addWidget inside the grid added or removed events, the items passed in the event for the

Calling addWidget inside the "added" event triggers another "added" event with the items argument containing the newly added item and the initial item that triggered the first added event. The second "added" event should contain only the newly added item.

This happens because the "added" event is triggerd first and the internal addedNodes array is emptied afterwards. The fix was to empty the addedNodes array before triggering the "added" event.

The same happens when calling removeWidget inside the "removed" event.

@adumesny
Copy link
Member

would be great if you didn't reformat/pretty the existing code...

@adumesny adumesny merged commit d9639ec into gridstack:master Feb 17, 2024
@galizhur
Copy link
Contributor Author

would be great if you didn't reformat/pretty the existing code...

yeah. sorry about that. i didn't notice there were so many reformats :(

@galizhur galizhur deleted the bug/added_remove_nodes_cleanup branch February 24, 2024 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants