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

Links with identical href will remove urls from preloadVisibleLinks queue even if these should actually be preloaded. #104

Closed
hirasso opened this issue Sep 12, 2023 · 1 comment · Fixed by #105

Comments

@hirasso
Copy link
Member

hirasso commented Sep 12, 2023

Description of the issue

Imagine a sub page of a website where there is a link to let's say /, both at the very start as well as in the footer of the document. preloadVisibleLinks will never preload the first element on the page, even though it's in the viewport. The reason for that is that the the link to / in the footer is not in the viewport and thus will immediately remove the link again, just after it was added for the first link.

Workaround

Providing a data-swup-preload attribute manually.

Possible Solution

Haven't thought about a solution, yet 😄 ...but we definitely need one.

@daun
Copy link
Member

daun commented Sep 12, 2023

Interesting. I'd have hoped the intersection observer fires only when the visibility state actually changes, not initially. Admittedly, that part is very much inspired by quicklink and seems to have the same problem with duplicate links.

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 a pull request may close this issue.

2 participants