TanStack / TanStack/router

Start: route masks with unmaskOnReload lose the real route on hard reload

Open
#7,115 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Start

Describe the bug

When a route mask uses unmaskOnReload: true, client navigation works, but a hard reload in TanStack Start SSR keeps the browser on the masked URL.

In the repro, the real route is still present in window.history.state.__tempLocation, but the server renders /. Hydration then lands on / instead of /modal, so the modal route disappears.

Your Example Website or App

https://github.com/tmm/tanstack-mask-reload-repro

Steps to Reproduce the Bug or Issue
  1. Open /
  2. Click Open masked modal
  3. Confirm the modal opens while the URL still shows /
  4. Hard reload the page
Expected behavior

After reload, the router should restore /modal before hydration and keep the modal rendered.

Screenshots or Videos

No response.

Platform
  • Router / Start Version: @tanstack/react-router 1.168.10, @tanstack/react-start 1.167.16
  • OS: macOS
  • Browser: Chrome
  • Browser Version: current stable
  • Bundler: Vite
  • Bundler Version: 7.3.2
Additional context

Client navigation behaves correctly. This seems specific to SSR reloads with unmaskOnReload: true.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked tanstack-mask-reload-repro and reproduce the hard reload after opening the masked modal. Inspect how the real route in window.history.state.__tempLocation is handled during SSR and hydration; done means reloading restores /modal and keeps the modal rendered instead of rendering /.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vite
Domain
full-stack
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.