solid-router icon indicating copy to clipboard operation
solid-router copied to clipboard

`window.location` holds incorrect value on initial client-side render

Open Tommypop2 opened this issue 1 year ago • 4 comments

Describe the bug

When client-side navigating to a different route, the window.location property still holds the data for the previous route. This means that any components using this data display the incorrect value for the current route.

This can be worked around by putting the window.location call inside of a setTimeout with a delay of about 20ms, but this is a pretty non-ideal workaround

Your Example Website or App

https://github.com/Tommypop2/router-bug-repro

Steps to Reproduce the Bug or Issue

Go to index route. Press "About" button to client-side navigate to the "about" route. Observe "window.location.href" still being from the previous route (http://localhost:3000/)

Expected behavior

One would expect to see the location property being up-to-date with the current route.

Screenshots or Videos

image

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

Tommypop2 avatar May 26 '24 15:05 Tommypop2