-
-
Notifications
You must be signed in to change notification settings - Fork 334
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
[Autocomplete] and [LiveComponent] don't play well together #407
Comments
Yes, any time the live component re-renders, the autocomplete function is lost, no matter the cause for the re-render.
Stimulus knows about everything, but is told to do nothing. I fixed it and I have a gif to prove it! Note |
…nklan) This PR was merged into the 2.x branch. Discussion ---------- Unset TomSelect after destroying the Stimulus Controller | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Tickets | [407](#407) | License | MIT Sometimes Stimulus re-uses an instance of a controller after it's destroyed and re-created - for example when a Live Twig Component re-renders. Without unsetting the variable, [connect() method thinks TomSelect is already in place, and does nothing](https://github.com/symfony/ux/blob/2.x/src/Autocomplete/assets/src/controller.ts#L21-L25). Commits ------- 01916e6 Unset tomSelect after destroying the instance
…nklan) This PR was merged into the 2.x branch. Discussion ---------- Unset TomSelect after destroying the Stimulus Controller | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Tickets | [407](symfony/ux#407) | License | MIT Sometimes Stimulus re-uses an instance of a controller after it's destroyed and re-created - for example when a Live Twig Component re-renders. Without unsetting the variable, [connect() method thinks TomSelect is already in place, and does nothing](https://github.com/symfony/ux/blob/2.x/src/Autocomplete/assets/src/controller.ts#L21-L25). Commits ------- 01916e6 Unset tomSelect after destroying the instance
Re-opening - this is kind of a duplicate of #354, but we can close when live works well with autocomplete |
…nklan) This PR was merged into the 2.x branch. Discussion ---------- Unset TomSelect after destroying the Stimulus Controller | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Tickets | [407](symfony/ux#407) | License | MIT Sometimes Stimulus re-uses an instance of a controller after it's destroyed and re-created - for example when a Live Twig Component re-renders. Without unsetting the variable, [connect() method thinks TomSelect is already in place, and does nothing](https://github.com/symfony/ux/blob/2.x/src/Autocomplete/assets/src/controller.ts#L21-L25). Commits ------- 01916e6 Unset tomSelect after destroying the instance
I noticed when the UX Autocompleter is part of the form and the form is rendered as a live component following https://symfony.com/bundles/ux-live-component/current/index.html#forms, the UX Autocompleter disappears once the component refreshes.
I made a minimal PoC site to demo the problem: https://github.com/janklan/symfony-ux-playground/tree/autocompleter-and-form-structure
This is what is happening:
The text was updated successfully, but these errors were encountered: