Skip to content

Browser back navigation does not work when using replaceState with React enabled #19839

@eberleant

Description

@eberleant

Description of the bug

If the current page used replaceState to modify the page history in an afterNavigation observer (for example, to add a query parameter), page history gets messed up. This causes back navigation using the browser back button to go back to 2 pages ago, instead of one page ago.

This worked in v23 but is broken in v24. A workaround is to disable React.

Expected behavior

Back navigation should only go back one page.

Minimal reproducible example

react-router-back-nav.zip

Run using mvn jetty:run and open localhost:8080.

Versions

  • Vaadin / Flow version: 24.4.10

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Closed

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions