router icon indicating copy to clipboard operation
router copied to clipboard

Context missing on route preload

Open jakst opened this issue 1 year ago • 0 comments

Describe the bug

When preloading a route inside a layout, the context defined in beforeLoad on that layout is not there on the first render of the layout when accessing it through Route.useRouteContext().

Your Example Website or App

https://stackblitz.com/edit/github-spzf56?file=src%2Froutes%2F_layout.tsx

Steps to Reproduce the Bug or Issue

  1. Open Stackblitz
  2. Hover the About link to trigger a preload
  3. Observe app crashing

Expected behavior

I expect the static context defined on beforeLoad to always be available in the component using Route.useRouteContext()

Screenshots or Videos

No response

Platform

  • OS: MacOS
  • Browser: Arc (Chromium)
  • Version: 125

Additional context

No response

jakst avatar May 20 '24 09:05 jakst