Skip to content

[svelte] await_reactivity_loss / Detected reactivity loss when reading _updated. #16914

Description

@GauBen

Hi! Found a small bug this morning after a dependency upgrade

Describe the bug

When upgrading from Svelte 5.56.9 to 5.56.10, SvelteKit 3.0.0-next.23 started logging warnings for reactivity loss in pages using top-level await:

[svelte] await_reactivity_loss
Detected reactivity loss when reading `_updated`. This happens when state is read in an async function after an earlier `await`
https://svelte.dev/e/await_reactivity_loss

traced at: 
    notify_version client.svelte.js:198
    remote_request shared.svelte.js:118
    resource prerender.svelte.js:99
    Prerender prerender.svelte.js:159
    prerender prerender.svelte.js:66
    consequent_3 +page.svelte:89
    consequent_3 +page.svelte:306
    header +page.svelte:89

client.svelte.js:198 is

export function notify_version(new_version) {
	if (__SVELTEKIT_APP_VERSION_CHECKS_ENABLED__ && new_version) {
		_updated ||= new_version !== version;
	}
}

Which in turn suggests that sveltejs/svelte#18594 changed the behavior of ||= for all state variables, not just private fields

Update: my code was not working in 5.56.9 because of sveltejs/svelte#18661, so I assumed it happened between 5.56.9 and 5.56.10, but it also reproduces with 5.56.9

Reproduction

In progress

Logs

System Info

Svelte 5.56.10
SvelteKit 3.0.0-next.23

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions