-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: MPA fallback for when SPA Link navigation is too slow #7915
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
base: main
Are you sure you want to change the base?
Conversation
|
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
6ec50b1
to
effa015
Compare
f4f9428
to
52aa032
Compare
What is it?
Description
Add an MPA fallback for when SPA navigation is too slow. SPA needs to execute all the bundles to perform CSR. When there are above a 100 bundles this can take >10s. The idea is to fallback to MPA when this happens.
This will only fallback on first navigations if the bundles haven't been preloaded yet. If the bundles have been preloaded or cached by the browser (disk or memory cache), it will always be SPA.
This feature is on by default and can be turned off by the developer with
<Link fallbackToMpa={false}>
. As explained in the code comments the threshold is not configurable yet. This depends on how well this feature is received in real projects, but also on what the threshold is based on: number of bundles needed to be preloaded for the next route, or the size of these bundles. In the future, we might be able to speed up SPA so much that falling back to MPA will never make sense.TODO
Checklist
pnpm change