Skip to content

fix(preload): intentPreload preloads a link once per visit - #680

Merged
ryansolid merged 1 commit into
nextfrom
claude/project-thread-xvubyg
Oct 13, 2026
Merged

ryansolid merged 1 commit into
nextfrom
claude/project-thread-xvubyg

Conversation

@ryansolid

Copy link
Copy Markdown
Member

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 the mousemove path checked lastElement; focusin and touchstart preloaded unconditionally.

After: each link preloads once per visit, whichever intent arrives first. Focus and touch share the hover path's lastElement check, 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.ts half of #677 and applies to every route. The in-flight dedupe for serverRouteComponent's render call is still open in that issue.

How: in onIntent, the not-a-link early return and the lastElement check now run for all three event types. Focus and touch then clear the timer, set lastElement and 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 on next with 2 calls instead of 1. pnpm test passes 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

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
@ryansolid ryansolid self-assigned this Oct 13, 2026
@changeset-bot

changeset-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4a85130

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/router Patch

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

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