Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make React router raise an error when History.replaceState() URL is not of the same origin as the current URL #20872

Open
mcollovati opened this issue Jan 17, 2025 · 0 comments

Comments

@mcollovati
Copy link
Collaborator

Currently, in Vaadin applications with React router enabled, when invoking Page.getHistory().replaceState() passing an absolute URL that is not of the same origin as the current URL, the browser URL is updated by appending the given URL to the document URL.

For example, Page.getHistory().replaceState(null, "http://www.google.com") will result in the browser URL to be http://localhost:8080/http://www.google.com.

However, with Vaadin router, the same call results in an error in the browser console

Image

Based on the Javascript History.replaceState() documentation, this seems to be the expected behavior.

url Optional
The URL of the history entry. The new URL must be of the same origin as the current URL; otherwise the replaceState() method throws an exception.

It would make sense that the Vaadin application behaves the same way, regardless of the router used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Low Priority (P3)
Development

No branches or pull requests

2 participants