Skip to content

RFC: MPA fallback for when SPA link navigation is too slow #314

@shairez

Description

@shairez

Discussed in #304

Originally posted by maiieul September 11, 2025

What is it about?

Providing an MPA fallback for when SPA navigation is too slow

What's the motivation for this proposal?

Problems you are trying to solve:

  • SPA needs to execute all the bundles to perform CSR. When a user loads a page in SPA for the first time, clicking on an SPA Link and preloading is still ongoing, if there are above a 100 bundles to preload for the next route, this can take >10s.

Goals you are trying to achieve:

  • Make navigations faster if SPA navigation is too slow.

Proposed Solution / Feature

What do you propose?

Fallback to MPA if more than a 100 bundles need to be preloaded on click/tap. If the bundles have been preloaded or cached by the browser (disk or memory cache), it will always be SPA.

Code examples

This feature is on by default and can be turned off by the developer with <Link fallbackToMpa={false}>.


Links / References

Draft PR in progress: QwikDev/qwik#7915

As explained in the code comments the threshold is not configurable yet. This should probably not be implemented until the MPA fallback has been tested in production. We should also not make it configurable until we figure what the threshold should be based on: number of bundles needed to be preloaded for the next route, or the size of these bundles. Using the size is more precise, but it also adds more weight to the bundle-graph. In the future, we might be able to speed up SPA so much that falling back to MPA will never make sense.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress (STAGE 2)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions