-
-
Notifications
You must be signed in to change notification settings - Fork 328
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] + [LiveComponent] Infinite loop of requests with data-model on autocomplete. #1499
Comments
Do you see a difference in the order the Controller are initalized / connected ? |
Fixed in #1502 To fix your issue before that PR is merged (and also verify that my fix addresses your issue), add an empty <select class="form-control" data-model="companyGroupType" data-action="live#action" data-action-name="onCompanyGroupTypeUpdated">
<option value="">Choose a group type></option>
{% for type in groupTypes %}
<option value="{{ type.id }}">
{{ type.name }}
</option>
{% endfor %}
</select>
<select class="form-control my-1" data-model="companyGroup" {{ stimulus_controller('symfony/ux-autocomplete/autocomplete') }}>
<option value="">Choose a group></option>
{% for group in companyGroups %}
<option id="{{ group.id }}" value="{{ group.id }}">
{{ group.name }}
</option>
{% endfor %}
</select> Let me know if this workaround addresses the issue :). Cheers! |
Hi @weaverryan, Thanks a lot for your time ! It fix well the infinite loop of requests :) But, I see another problem (with both your PR and the empty Edit : I don't know if can help : I tried to change my companyGroup to an ID in int instead of entity. It seems the component make two rendering (I have a loading in the twig, that is launched two times consecutively), the first with the value changed in the |
Hi,
I've got a
LiveComponent
with two selects whose havedata-model
on them. First one to choose a "groupType", second one to choose a "companyGroup". "companyGroup" is the one withautocomplete
.So when I change my groupType, my companyGroups list has to change too. But when I change the groupType, it actually launch an infinite loop of requests on my component...
Here is my code :
Component :
Twig :
Screen of the console after changed the first select :
I tried with a
data-action
instead ofdata-model="companyGroup"
to manually change companyGroup value, same problem.If I remove the
{{ stimulus_controller('symfony/ux-autocomplete/autocomplete') }}
everything work well (but no autocomplete...)If i downgrade
symfony/ux-autocomplete
to 2.13.3 it works well too.I know autocomplete and liveComponent not work very well together, but maybe is there something I miss to make this work ?
Thanks,
Pierre
The text was updated successfully, but these errors were encountered: