Skip to content
Source
Sign inSign up
TanStack/router

Link Preloading breaks context when using selective ssr #4614

Closedphibr0(GitHub profile, opens in a new tab) opened this issue 0 comments

Which project does this relate to?

Start

Describe the bug

When defaultPreload is enabled (e.g., set to 'intent') and loaders run on both the server and client (using the selective SSR feature), stale values are present in the router context.

I believe this is a bug as disabling preload fixes this and works as expected.

  • In the linked project I create environment specific context in the __root beforeLoad and log it.
  • The two pages / and /test have ssr set to false (beforeLoad runs client side)

Your Example Website or App

https://github.com/phibr0/tss-bug-repro

Steps to Reproduce the Bug or Issue

  1. launch repro and open devtools
  2. isServer is true which is correct as __root ran on the server even though the logging is client side Image
  3. hover over the link
  4. As expected __root runs and correctly logs isClient, but /test runs with stale context and still shows isServer Image Only when actually navigating to the page is the context passed through

Expected behavior

__root should pass the new context to the next route

Screenshots or Videos

No response

Platform

  • Router / Start Version: Start: 1.126.1 Router: 1.125.6 (latest)
  • OS: mac
  • Browser: Chrome

Additional context

No response

Sign in to join this conversation.