Skip to content

Navigating to the same page in a different locale with a hash does not update props #23467

@destruc7i0n

Description

@destruc7i0n

What version of Next.js are you using?

10.0.9

What version of Node.js are you using?

14.16.0

What browser are you using?

Chromium Edge

What operating system are you using?

macOS

How are you deploying your application?

Vercel

Describe the Bug

For a language switcher, I only change the locale for the page and nothing in the url. Using router.push with the Url object representing the current page and setting hash to the hash of the current page, there is only a hashChangeStart and subsequent hashChangeComplete event and not a props update.

Expected Behavior

There should be a page update (for fetching new translations etc.) while keeping the hash in the url.

To Reproduce

https://codesandbox.io/s/heuristic-blackburn-jpu7g

In the demo, go the "About Page" or the "Post Page". Click on the "Change Language" button. The value of the locale in useRouter updates while the props do not. There are also the hashChange events in the console.
Setting router.push to not set the hash (in components/demo) causes a props update as expected but removes the hash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions