Skip to content
Source
Sign inSign up
TanStack/router

`useRouteContext` returns undefined when navigating with `<Navigate />` #1892

Send to my agent
Closednklhtv(GitHub profile, opens in a new tab) opened this issue 1 comment

Describe the bug

Context is undefined when using <Navigate /> to redirect. The bug does not occur if you remove React.StrictMode The bug does not occur if you remove the empty beforeLoad from postsRoute on line 46

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-fuvvzs

Steps to Reproduce the Bug or Issue

  1. run the app
  2. wait 1 second for the setTimeout to trigger
  3. check logs in console, context is undefined

Expected behavior

context to be an object

Screenshots or Videos

No response

Platform

  • OS: mac
  • Browser: Chrome
  • Version: any

Additional context

Could be related or a duplicate of: https://github.com/TanStack/router/issues/1886 https://github.com/TanStack/router/issues/1751 https://github.com/TanStack/router/issues/1740 but non of those mentions <Navigate />

  1. SeanCassiere added labelsbug

Sign in to join this conversation.