Skip to content

Potential useSearch bug not triggering updates when used with urql #393

Open
@junwen-k

Description

@junwen-k

Greetings, I've been scratching my head over this issue for quite awhile.
Following #368, I've been using the useSearchParams hook and it has been working fine, until I started integrating with urql's useQuery.

Issue

useSearch does not rerender if it begins with query params and revisited. For example, if I land on the page with URL

http://localhost:5173/?tab=1

I cannot go back to original tab after switching to another tab. (URL has been updated to ?tab=1, but React does not rerender the components. You may see the video below:

Screen.Recording.2023-12-01.at.8.59.27.PM.mov

Reproduction Steps

  1. Clone https://github.com/junwen-k/react-router-wouter

     git clone https://github.com/junwen-k/react-router-wouter
     cd react-router-wouter
    
  2. Install dependencies

     npm install
    
  3. Start Server

     npm start
    
  4. Experiment with the page, with default ?tab=1 triggers the issue

Context

Suspect pushState event does not trigger, hence React does not rerenders the component.
React Router's version works perfectly, so I suspect this is something to do with wouter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions