Skip to content

Svelte reactivity bug #15487

@ivands

Description

@ivands

Describe the bug

I'm getting weird reactivity problems in my project that I can't seem to replicate on stackblitz.
But the main issue is that calling the goto() function that only changes the search params of the URL will trigger the $effect on the tags variable.
First of all, this should not happen.
But even weirder is that the group variable doesn't change.
Even tho group is the only dependency of tags.
Also, I noticed this doesn't happen when I refresh the page.
But after navigating from 1 page to another, the bug appears again.

My code:

	let group = $derived(page.params.group!);
	let name = $derived(capitalCase(group));
	let tags = $derived(new Set(group === 'all-games' ? [] : [group]));
	let sort = $derived(page.params.sort as 'new');

	$effect(() => {
		console.log(group);
	});

	$effect(() => {
		console.log(tags);
	});

	$effect(() => {
		console.log(sort);
	});

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-d5epz9mx?file=src%2Froutes%2F%5Bslug%5D%2F%5B%5Brest%5D%5D%2F%2Bpage.svelte

I tried to make a replica of the problem.
But for some reason, I can't get it to trigger.
Maybe the replica will still help

Logs

System Info

System:
    OS: macOS 26.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 112.14 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - /Users/.../.nvm/versions/node/v22.12.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.9.0 - /Users/.../.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 10.5.2 - /opt/homebrew/bin/pnpm
    bun: 1.3.9 - /opt/homebrew/bin/bun
    Deno: 2.2.4 - /opt/homebrew/bin/deno
  Browsers:
    Chrome: 145.0.7632.117
    Firefox: 147.0.4
    Safari: 26.3
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.1 => 7.0.1
    @sveltejs/enhanced-img: 0.10.2 => 0.10.2
    @sveltejs/kit: ^2.53.4 => 2.53.4
    @sveltejs/vite-plugin-svelte: 6.2.4 => 6.2.4
    svelte: 5.53.7 => 5.53.7
    vite: ^7.3.1 => 7.3.1

Severity

blocking an upgrade

Additional Information

I did enable experimental async Svelte

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions