Repository navigation
fix(preload): intentPreload preloads a link once per visit - #680
Merged
Merged
Conversation
Focus and touchstart now share the hover path's lastElement check, and a focus or touch cancels a pending hover timer. A click after a hover rest, or a click with no dwell, sends one preload instead of two (#677). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R2FCNsvaipU3xXx9p83VUs
🦋 Changeset detectedLatest commit: 4a85130 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ryan · project thread
Before: with
intentPreload, a click after a hover rest preloaded the link twice, once from the hover timer and again when mousedown focused the link. A click with no dwell also preloaded twice, because the focus preloaded and the pending 20 ms hover timer still fired afterwards. Only themousemovepath checkedlastElement;focusinandtouchstartpreloaded unconditionally.After: each link preloads once per visit, whichever intent arrives first. Focus and touch share the hover path's
lastElementcheck, and they cancel a pending hover timer. Moving the pointer or focus to something that isn't a link resets the check, so coming back to the link preloads it again.This is the
src/preload.tshalf of #677 and applies to every route. The in-flight dedupe forserverRouteComponent's render call is still open in that issue.How: in
onIntent, the not-a-link early return and thelastElementcheck now run for all three event types. Focus and touch then clear the timer, setlastElementand preload immediately.Testing: there are five new cases in
test/data/events.spec.ts: hover then click, click with no dwell, touch then focus, focus on two links, and refocus after focus moves elsewhere. The first three fail onnextwith 2 calls instead of 1.pnpm testpasses 618 client and 96 server tests, and the type check is clean.Refs #677.
🤖 Generated with Claude Code
https://claude.ai/code/session_01R2FCNsvaipU3xXx9p83VUs
Generated by Claude Code