You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a link appears on the page twice ‒ once inside and once outside the viewport ‒ and a delay has been set, the link will not cause prefetching/prerendering.
The page to be prefetched, as at least one link to it is in-viewport.
The IntersectionObserver detects that the first link is in-viewport, and appropriately pushes into the hrefsInViewport array. It immediately afterwards detects that the second link is not in-viewport, and thus removes the freshly added item from hrefsInViewport. hrefsInViewport ‒ as the name suggests ‒ contains hrefs, thus links with equal hrefs are indistinguishable in this context.
I am willing to submit a PR, but would like to make I'm not the only one who thinks this is unexpected.
One possible solution would be storing some identifier for a link that is unique to it, rather than the href (which is not necessarily unique). Such an identifier could be generated like so:
Describe the bug
When a link appears on the page twice ‒ once inside and once outside the viewport ‒ and a delay has been set, the link will not cause prefetching/prerendering.
To Reproduce
Expected behavior
The page to be prefetched, as at least one link to it is in-viewport.
The
IntersectionObserver
detects that the first link is in-viewport, and appropriately pushes into thehrefsInViewport
array. It immediately afterwards detects that the second link is not in-viewport, and thus removes the freshly added item fromhrefsInViewport
.hrefsInViewport
‒ as the name suggests ‒ contains hrefs, thus links with equal hrefs are indistinguishable in this context.I am willing to submit a PR, but would like to make I'm not the only one who thinks this is unexpected.
One possible solution would be storing some identifier for a link that is unique to it, rather than the href (which is not necessarily unique). Such an identifier could be generated like so:
The text was updated successfully, but these errors were encountered: