Skip to content

Recover Pages navigation gracefully across application deployments #849

Open

Description

@TheAlexLichter

An already-open tab can fail during SPA navigation after a new deployment. It would be good to have a default handling (which can be disabled) to handle this case by default.

Reproduction

  1. Deploy an application with multiple pages and open it.
  2. Leave the tab open.
  3. Change a page or shared component and deploy the application again (=> new chunk hashes)
  4. In the existing tab, navigate to a page whose chunks have not been loaded.
  5. The client requests the old version's chunks, which may now return 404. Recovery can also fail if the error component needs a missing chunk.

Expected behavior

An intentional navigation should recover to its requested destination when the client can establish that a different application version is required.
The query string and fragment should survive, and the current page should remain visible until recovery starts.

  • Prefetch should never reload the tab.
  • Network failures should not be treated as deployment changes
  • Never replay mutations automatically
  • No additional checks for healthy navigations (no slowdown)

State of the Art in toher frameworks

Inertia’s protocol provides prior art for version negotiation, GET navigation fallback and background request handling. SvelteKit’s version management provides prior art for detecting a new build and recovering from a page-load failure.

Solution ideas

The shared Pages router and server transport could support application version negotiation and load recovery

The existing X-VoidPages-Version check already covers the wire format. An application version would address regular deployments that change components or page props (no protocol changes).

Version information could travel with existing page requests and responses. The router can do the rest (check compat, handle import failures while keeping state etc)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions