Fixes leaky savedInputChecked across multiple instances #2369
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.
Steps to Reproduce Issue
Create two sortables on the same page: List A and List B
The
options.handle
must be specified for some reasonAdd an event when a checkbox is unchecked inside List A
Set event to destroy and replace SortableJS on List B
Problem
All checkboxes on List A are rechecked when List B is rebound (via
_nulling
)Expectation
The checkbox should remain unchecked
Proposed Fix
It seems to happen because
savedInputChecked
is a global instance. So List B's store will contain List A's checkboxes...The proposed code ensures the checkboxes remain within the scope of the relevant instance.
Related
This may be a solution to #1052's continuation since people are still suggesting it's broken.
It could be why you can't reproduce it, since two SortableJS instances are needed to produce the collision/outcome.