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

Controller declaration order matters ? #82

Open
Wait4Code opened this issue Aug 23, 2023 · 0 comments
Open

Controller declaration order matters ? #82

Wait4Code opened this issue Aug 23, 2023 · 0 comments

Comments

@Wait4Code
Copy link

After upgrading to v3.2.2, i've noticed that declaration order of stimulus controllers in HTML matters.
In my project I'm using symfony/ux-autocomplete and I have a custom controller to override tom-select options rendering.
All my controllers are fetch in eager mode.

Here is an example :

<select id="new_link_sap_order_item" class="form-control" required
        {{ stimulus_controller({
            'symfony/ux-autocomplete/autocomplete':{
                url: path('colporteur_find_sap_order_lines')
            },
            'colporteur--sap-order-item-select':{},
        }) }}>
</select>

Not declaring colporteur--sap-order-item-select before symfony/ux-autocomplete/autocomplete in the HTML, leads to custom controller connecting but never intercepting the autocomplete:pre-connect event dispatched by ux-autocomplete controller.

Obviously, i've fix this by putting my custom controller in first position :

<select id="new_link_sap_order_item" class="form-control" required
        {{ stimulus_controller({
            'colporteur--sap-order-item-select':{},
            'symfony/ux-autocomplete/autocomplete':{
                url: path('colporteur_find_sap_order_lines')
            }
        }) }}>
</select>

But I do not really like things that depends on declaration order to work.
Is this a wanted behaviour ? Maybe I'm opening issue in the wrong repo and should open it on symfony/ux one ?

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

No branches or pull requests

1 participant