Skip to content

Context is undefined when search validation fails #1656

@geoff-harper

Description

@geoff-harper

Describe the bug

I've discovered that the missing context bug isn't fully fixed in 1.33.7. Also sorry for sort of spamming the other closed issue, I thought I'd open a new one.

I'm not completely sure of what's triggering it or if there's more cases but these are the steps in my own app

  1. open a route with no search validation (not sure this part is relevant)
  2. directly enter a route into the address bar that has search validation, but don't include any search params in the address
  3. navigate to the route, context should be undefined

My schema catches and fills values like the docs suggest. In step 3 when the error component is fired, it does still put the caught values into the url. I broke the validateSearch method into pieces instead of directly returning a schema, and it specifically fails when anything is returned in the method.

Your Example Website or App

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

Steps to Reproduce the Bug or Issue

  1. Go to the about route
  2. Go to index route through address bar, omit search params

Expected behavior

Context should be defined in all cases

Screenshots or Videos

No response

Platform

  • Browser: all
  • Version: 1.33.7

Additional context

No response

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