Skip to content
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

Prevent .selectize() updates from destroying .data() and event listeners #3923

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Oct 25, 2023

This PR reverts #3890 (which closed #3889) and instead reverts a recent change made to selectize.js to fix that same issue. As this comment highlights, that selectize.js change removes .data() and event listeners attached to the <select> tag (or any of it's children), which is problematic for our selectInput binding since bindings are storied/acquired via .data() (and it also relies on change events to set values back to the server).

#3890 originally worked around the issue by unbinding before and binding after any update occurs (akin to how dynamic UI works), but after #3904, to do that properly would further complicate an already complex selectInput binding. Also, once I came back to look more deeply at this, it felt like this destruction action has a pretty good chance of breaking 3rd party code. And, since it seems the selectize.js change is solely about performance, it seems best to just revert it (it feels like a future release of selectize.js might have to do something similar -- or at least change that section in such a way that we'll get alerted by it).

@cpsievert
Copy link
Collaborator Author

Talked though this in person with @gadenbuie

@cpsievert cpsievert merged commit a1b9fda into main Oct 26, 2023
1 check passed
@cpsievert cpsievert deleted the selectize-bind-revert branch October 26, 2023 22:42
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.

Regression in updateSelectizeInput() introduced by v0.15.2
1 participant