Skip to content

SSR should fail if setContext is used after an await #17233

@Rich-Harris

Description

@Rich-Harris

Describe the bug

Code like this...

<script>
	import { setContext } from 'svelte';

	await Promise.resolve('hi');

	setContext('key', 'value');
</script>

...fails in CSR, because we need to set context before doing any out-of-order rendering. But it doesn't fail in SSR. It should. The relevant test is currently skipped: https://github.com/sveltejs/svelte/pull/17154/files#r2558303462

Reproduction

playground

Logs

System Info

latest

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions