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

Normalize history cache keys - redux #1338

Merged

Conversation

croxton
Copy link
Contributor

@croxton croxton commented Mar 24, 2023

  1. Since LocalStorage is bound to the origin (domain/protocol/port triplet), we can normalize the URL format used as a key for a history snapshot to reduce cache misses for the same URL but referenced differently. E.g.: https://mysite.com/about, /about and /about/ are normalized to /about. Cache misses also mean that the scroll position of the previously visited page is lost, which can result in unexpected scroll jumps that are hard to track down.

  2. Prevent potential key collisions in boosted relative links, by converting the href to a fully resolved root-relative path. E.g. a boosted anchor shoe.html in the directory products becomes /products/shoe.html.

  3. As IE11 doesn't understand URL, we silently catch the exception and return the unadulterated path. This is safer than messing about with a regex polyfill.

  4. Adjust the boosted element hx-disinherit sanity check test to check for the fully-resolved href of the boosted anchor.

@1cg 1cg merged commit 192df25 into bigskysoftware:master Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants