Skip to content

Context is missing from parent loader when child's validateSearch fails #4696

Closed

Description

@Dakkers

Which project does this relate to?

Router

Describe the bug

When a parent route (in my case, the root route) has a beforeLoad parameter, the parent route's loader's context is missing expected attributes when a child route's validateSearch fails.

StackBlitz project

StackBlitz container

Your Example Website or App

https://vitejsvitepmq9xxrp-by02--5173--96435430.local-credentialless.webcontainer.io/

Steps to Reproduce the Bug or Issue

  1. Go to the example site
  2. Go to the dashboard link
  3. Ensure you can see the navbar (this is working)
  4. Remove the query parameters from the URL and press enter (to navigate directly to /dashboard with no query params)
  5. You will not see the Navbar anymore 🐛

Expected behavior

I expected the parent route's loader to have the values of the context that were returned by the same route's beforeLoad but the attributes are missing.

Screenshots or Videos

Screen.Recording.2025-07-18.at.10.00.33.mov

Platform

  • Router / Start Version: 1.128.3
  • OS: MacOS
  • Browser: Chrome
  • Browser Version: 138.0.7204.157 (Official Build) (arm64)
  • Bundler: Vite
  • Bundler Version: 7.0.5

Additional context

Related issues, PRs, discussions:

Activity

  1. Dakkers commented on Jul 18, 2025

    @Dakkers
    Author

    My super awesome coworker @danconnell found out that this behaviour doesn't occur in 1.121.14, but it does on the Stackblitz instance which is 1.128.3, so I will do a bit more work to figure out when it started happening again.

  2. Dakkers commented on Jul 18, 2025

    @Dakkers
    Author

    It seems that the bug started occurring again in version 1.123.2. (1.123.0 had no issues.)

    I would assume it's because of this PR because it makes modifications to beforeLoad / loader logic: #4550

  3. schiller-manuel commented on Jul 18, 2025

    @schiller-manuel
    Collaborator

    could you add a failing unit test via a PR?

  4. Dakkers commented on Sep 24, 2025

    @Dakkers
    Author

    @schiller-manuel This may have been resolved by now, but I'm not 100% sure how to verify this with the CI. My PR is here: #4726

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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