Reputation: 2037
The Qwik framework documentation mentions that there will be only one listener and all other listeners are serialized and attached to the DOM e.g: on:click
etc. An elaborate caching algorithm is in place using service worker.
In my understanding, for the users loading our application first time, if the onClick bundle is not found in the cache, it will be fetched from the network after the click event is triggered. If we are not using CDNs or on a slow network, there will be a network latency of even 400+ms which could be hampering the user experience. Any solutions for this scenario?
Upvotes: 4
Views: 707
Reputation: 540
Actually, the user interaction can still be slow because of slow internet connection due to client connectivity such as 3g on phone.
For Qwik component, it would be nice to display a spinner at the place where the component is supposed to render
Upvotes: 0
Reputation: 47946
on:click
are present on the page and instantly starts to download them as soon as you navigate to the page.The above two actions should ensure that the JS is ready when the user is ready to interact with the page. It should be very difficult for the user to get into a state where the JS is not present in the cache.
NOTE: If the user interacts before the service worker downloads, the JS URL will be prioritized and loaded next. The SW will ensure that there will be no request duplication (user request + SW request for the same URL)
To further improve performance, listeners who are often used should be bundled into a single chunk, minimizing the number of downloads.
To contrast this with the traditional approach:
Upvotes: 6