Skip to content

[Bug]: useSearchParams not giving correct value with useBlocker (reopen) #12256

@Fattimo

Description

@Fattimo

What version of React Router are you using?

6.27.0

I was able to repro the bug. This is a stackblitz with an environment that allows you to repro. I used 6.27.0

https://stackblitz.com/edit/github-ypgwe9?file=src%2Fapp.tsx,src%2Fmain.tsx

I've attached two videos explaining the bug as well:

  1. (control) Expected behavior:
Screen.Recording.2024-11-08.at.4.31.41.PM.mov
  1. Search params returning a value that should be blocked, IF using the (prev) value in the setSearchParams function
Screen.Recording.2024-11-08.at.4.32.21.PM.mov

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions