-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
I often hear from other developers having issues with reactive statements doing nothing. For instance:
<script>
export let data; // We use sveltekit
$: me = data.me;
$: hasThing = me.things.length > 0
setContext('hasThing', hasThing); // hasThing is always undefined??
</script>This won't work, and this behavior is documented:
https://svelte.dev/docs#component-format-script-3-$-marks-a-statement-as-reactive
I feel that this documentation is a bit underwhelming considering how often I hear about this problem.
What could help:
- A compiler warning
- A dedicated tutorial page
- A dedicated block in the documentation, around https://svelte.dev/docs#component-format-script-3-$-marks-a-statement-as-reactive
- An eslint rule
- You name it
Reproduction
Logs
No response
System Info
-Severity
annoyance
sophiebl, Lacusch, hanszoons, GauBen, paolodina and 4 more
Metadata
Metadata
Assignees
Labels
No labels
