You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #1505 [Autocomplete] Reset TomSelect when updating controller attributes (pierredup)
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
[Autocomplete] Reset TomSelect when updating controller attributes
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Issues | Fix#1500
| License | MIT
When using remote data for Autocomplete, the mutation observer is not started, so the select cannot be reset when some options change (E.G when limiting the options returned after selecting other options using extra_options from #1322).
Instead, we start the mutation observer when using remote data. When the observer runs and checks if the options have changes, we explicitly set the `areOptionsEquivalent` to `true`, since the page will just render an empty `select`. We also check if any of the `data-autocomplete` attributes changes and forces a reset (E.G using extra_options, the `data-autocomplete-url` value can be different when using extra options, so we reset the select when this attribute changes).
This fixes only one of the issues from #1500, I'll investigate the other issues and create separate PRs.
Commits
-------
d8fb3fb [Autocomplete] Reset TomSelect when updating controller attributes
0 commit comments