Skip to content

chore: prevent cursor carryover between preload test phases - #16510

Merged
Rich-Harris merged 1 commit into
sveltejs:version-3from
Nic-Polumeyv:preload-test-cursor-carryover
Jul 25, 2026
Merged

chore: prevent cursor carryover between preload test phases#16510
Rich-Harris merged 1 commit into
sveltejs:version-3from
Nic-Polumeyv:preload-test-cursor-carryover

Conversation

@Nic-Polumeyv

Copy link
Copy Markdown
Contributor

data-sveltekit-preload-data fails intermittently under server-side route resolution, about 1 in 6 locally on version-3, and anything that shifts hydration timing makes it worse (a one-line import change on #16308 took it to 3 failed retries in CI).

The test navigates between phases with the cursor still parked over the previous phase's link. When the fresh page hydrates, Chromium fires a mouse event at that position and the router preloads that link's target, so the phase that expects zero requests counts a preload it never triggered. A request timeline shows the target's __route.js, node script and __data.json all arriving before the phase's goto resolves, ahead of any hover.

Parking the mouse before each navigation removes the carryover. 10 of 10 runs green under ROUTER_RESOLUTION=server with the change.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 9d42896:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/9d42896474c8381f13952d86477ec71fc5fb7829

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16510

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9d42896

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, this is great! we've been meaning to set up an agent loop to tackle these flaky tests as they arise, but it never rises all the way to the top of the pile

@Rich-Harris
Rich-Harris merged commit 361dc59 into sveltejs:version-3 Jul 25, 2026
17 of 18 checks passed
@Nic-Polumeyv
Nic-Polumeyv deleted the preload-test-cursor-carryover branch July 30, 2026 22:54
mahenoorsalat pushed a commit to mahenoorsalat/kit that referenced this pull request Aug 23, 2026
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