Skip to content

Commit f846258

Browse files
committed
tweaks
1 parent 491600b commit f846258

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

documentation/docs/98-reference/.generated/compile-warnings.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -798,12 +798,13 @@ This warning is thrown when the compiler detects the following:
798798
In this case, the state reassignment will not be noticed by whatever you passed it to. For example, if you pass the state to a function, that function will not notice the updates:
799799

800800
```svelte
801-
<!--- Parent.svelte --->
801+
<!--- file: Parent.svelte --->
802802
<script>
803803
import { setContext } from 'svelte';
804804
805805
let count = $state(0);
806-
// warning: state referenced locally
806+
807+
// warning: state_referenced_locally
807808
setContext('count', count);
808809
</script>
809810
@@ -813,7 +814,7 @@ In this case, the state reassignment will not be noticed by whatever you passed
813814
```
814815

815816
```svelte
816-
<!--- Child.svelte --->
817+
<!--- file: Child.svelte --->
817818
<script>
818819
import { getContext } from 'svelte';
819820
@@ -824,15 +825,15 @@ In this case, the state reassignment will not be noticed by whatever you passed
824825
<p>The count is {count}</p>
825826
```
826827

827-
To fix this, reference the variable such that it is lazily evaluated. For the above example, this can be achieved by wrapping the count in a function:
828+
To fix this, reference the variable such that it is lazily evaluated. For the above example, this can be achieved by wrapping `count` in a function:
828829

829830
```svelte
830-
<!--- Parent.svelte --->
831+
<!--- file: Parent.svelte --->
831832
<script>
832833
import { setContext } from 'svelte';
833834
834835
let count = $state(0);
835-
setContext('count', () => count);
836+
setContext('count', +++() => count+++);
836837
</script>
837838
838839
<button onclick={() => count++}>
@@ -841,18 +842,18 @@ To fix this, reference the variable such that it is lazily evaluated. For the ab
841842
```
842843

843844
```svelte
844-
<!--- Child.svelte --->
845+
<!--- file: Child.svelte --->
845846
<script>
846847
import { getContext } from 'svelte';
847848
848849
const count = getContext('count');
849850
</script>
850851
851852
<!-- This will update -->
852-
<p>The count is {count()}</p>
853+
<p>The count is {+++count()+++}</p>
853854
```
854855

855-
For more info, see [the docs on `$state`]($state#Passing-state-into-functions)
856+
For more info, see [Passing state into functions]($state#Passing-state-into-functions).
856857

857858
### store_rune_conflict
858859

packages/svelte/messages/compile-warnings/script.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ This warning is thrown when the compiler detects the following:
6464
In this case, the state reassignment will not be noticed by whatever you passed it to. For example, if you pass the state to a function, that function will not notice the updates:
6565

6666
```svelte
67-
<!--- Parent.svelte --->
67+
<!--- file: Parent.svelte --->
6868
<script>
6969
import { setContext } from 'svelte';
7070
@@ -80,7 +80,7 @@ In this case, the state reassignment will not be noticed by whatever you passed
8080
```
8181

8282
```svelte
83-
<!--- Child.svelte --->
83+
<!--- file: Child.svelte --->
8484
<script>
8585
import { getContext } from 'svelte';
8686
@@ -91,15 +91,15 @@ In this case, the state reassignment will not be noticed by whatever you passed
9191
<p>The count is {count}</p>
9292
```
9393

94-
To fix this, reference the variable such that it is lazily evaluated. For the above example, this can be achieved by wrapping the count in a function:
94+
To fix this, reference the variable such that it is lazily evaluated. For the above example, this can be achieved by wrapping `count` in a function:
9595

9696
```svelte
97-
<!--- Parent.svelte --->
97+
<!--- file: Parent.svelte --->
9898
<script>
9999
import { setContext } from 'svelte';
100100
101101
let count = $state(0);
102-
setContext('count', () => count);
102+
setContext('count', +++() => count+++);
103103
</script>
104104
105105
<button onclick={() => count++}>
@@ -108,18 +108,18 @@ To fix this, reference the variable such that it is lazily evaluated. For the ab
108108
```
109109

110110
```svelte
111-
<!--- Child.svelte --->
111+
<!--- file: Child.svelte --->
112112
<script>
113113
import { getContext } from 'svelte';
114114
115115
const count = getContext('count');
116116
</script>
117117
118118
<!-- This will update -->
119-
<p>The count is {count()}</p>
119+
<p>The count is {+++count()+++}</p>
120120
```
121121

122-
For more info, see [the docs on `$state`]($state#Passing-state-into-functions)
122+
For more info, see [Passing state into functions]($state#Passing-state-into-functions).
123123

124124
## store_rune_conflict
125125

0 commit comments

Comments
 (0)