Is there a Vaadin Flow API equivalent of the @Uses annotation?
We have some views that are loaded dynamically at runtime from an extension JAR, and sometimes the Components on those views don’t render properly because the client-side support for the Components haven’t been loaded yet.
A workaround is to add @Uses for all of the necessary Components to the application’s home page, but that’s less than ideal both from a maintenance and a performance perspective.
That’s not going to work… how do you expect to know at build time which JavaScript has to be included if the information is only available at runtime?
Understood - the Component has to be referenced somewhere so that the frontend compiler knows to include it.
But - there seems to be some runtime behavior as well. For example, if the extension view uses a Popover component, and you’ve already visited another page that uses Popover, then it works fine. However, if you go to the extension view and haven’t previously visited a page that used Popover, then it won’t work on the extension view.
That’s only for development mode.
That’s true because the “normal view” knows about the Popover and has added it into the production bundle. You might wanna play around with optimizeBundle=false or other properties, but in the end you need Uses or another way to create a precomputed production build that contains all components. I doubt it’s worth the effort