Skip to content

Start: Updating search params when ssr: false causes page to unmount and remount #5956

@MTG2000

Description

@MTG2000

Which project does this relate to?

Router

Describe the bug

I noticed this issue on pages that have ssr: false

Normally, updating the search params on the same page doesn't cause a remount, just a re-render.
But in the case of ssr: false pages, the first time updating search params (by calling navigate) causes the page to remount.

I tested this by logging useId() hook value which shouldn't change when changing search params, but the first time they are changed it changes too.

See the reproduction below:

Your Example Website or App

https://github.com/MTG2000/tsr-remount-issue/blob/main/src/routes/posts_.%24postId.deep.tsx

Steps to Reproduce the Bug or Issue

  • Go to the post deep page
  • Check the console log to see the useId value
  • Click on Update Search Params button & notice that the useId() value changed
  • Click again and the useId value will NOT change anymore

Remove the ssr: false option & retry the above steps. You will notice that useId() value will not change at all.

Expected behavior

The page shouldn't remount on search params change.

Screenshots or Videos

20251124-1025-05.6674272.mp4

Platform

  • Router / Start Version: 1.139.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