Skip to content

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

@nklhtv

Description

@nklhtv

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:
#1886
#1751
#1740
but non of those mentions <Navigate />

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions