File tree 5 files changed +39
-1
lines changed
tests/runtime-runes/samples/onmount-prop-access
5 files changed +39
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' svelte ' : patch
3
+ ---
4
+
5
+ fix: ensure clearing of old values happens independent of root flushes
Original file line number Diff line number Diff line change @@ -692,6 +692,7 @@ function flush_queued_root_effects() {
692
692
var collected_effects = process_effects ( root_effects [ i ] ) ;
693
693
flush_queued_effects ( collected_effects ) ;
694
694
}
695
+ old_values . clear ( ) ;
695
696
}
696
697
} finally {
697
698
is_flushing = false ;
@@ -701,7 +702,6 @@ function flush_queued_root_effects() {
701
702
if ( DEV ) {
702
703
dev_effect_stack = [ ] ;
703
704
}
704
- old_values . clear ( ) ;
705
705
}
706
706
}
707
707
Original file line number Diff line number Diff line change
1
+ <script >
2
+ import { onMount } from ' svelte'
3
+
4
+ let thing = $state (0 )
5
+
6
+ onMount (() => {
7
+ thing = 1 ;
8
+ return () => {
9
+ console .log (thing);
10
+ }
11
+ })
12
+ </script >
Original file line number Diff line number Diff line change
1
+ import { test } from '../../test' ;
2
+
3
+ export default test ( {
4
+ async test ( { assert, logs } ) {
5
+ assert . deepEqual ( logs , [ 1 ] ) ;
6
+ }
7
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ import { onMount } from " svelte"
3
+ import Component from ' ./Component.svelte' ;
4
+
5
+ let key = $state (0 );
6
+
7
+ onMount (() => {
8
+ key = 1 ;
9
+ })
10
+ </script >
11
+
12
+ {#key key }
13
+ <Component />
14
+ {/ key }
You can’t perform that action at this time.
0 commit comments