Skip to content

Throwing primitives in beforeLoad causes the router to stop rendering #4707

@michaelbull

Description

@michaelbull

Which project does this relate to?

Router

Describe the bug

Calling throw in a beforeLoad with primitive types such as string or number causes the entire router to hang - preventing the errorComponent from rendering.

This leads to the entire application effectively no longer rendering the router.

Your Example Website or App

https://stackblitz.com/edit/github-6olvwv8v?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

Implement a beforeLoad in a route that calls throw with a string or number.

Expected behavior

I expect the value to be thrown and rendered in the errorComponent, irrespective of its data type.

Screenshots or Videos

Image

Platform

"@tanstack/react-router": "1.128.3"

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions