Priority for lazy chartjs custom controller #2179
Unanswered
SosthenG
asked this question in
Questions & Answers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm using Symfony UX Chart.js with a custom controller to add some plugins.
For performance reasons I want to load @symfony/ux-chartjs and my custom controller lazily because they are only needed on a few pages, but it does not work as I expected.
As my custom controller have to listen to the
chartjs:pre-connect
event, it needs to be loaded before the ux-chartjs controller is connected, but when both are lazy the opposite happens. I can see in the console that the ux-chartjs controller is initialized and connected before my custom controller, so the listener cannot be registered in time:When my custom controller is not lazy, it is loaded in the right order:
I'm using AssetMapper, in controllers.json ux-chartjs have
"fetch": "lazy"
and I added/* stimulusFetch: 'lazy' */
before my custom controller.What can I do to make this work? Is there a way to add lazy priorities to ensure my custom controller is loaded first or am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions