File tree 2 files changed +14
-11
lines changed
src/internal/client/reactivity
tests/runtime-runes/samples/async-derived-in-if
2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,7 @@ export class Batch {
107
107
this . render_effects = [ ] ;
108
108
this . effects = [ ] ;
109
109
110
- // commit changes
111
- for ( const fn of this . #callbacks) {
112
- fn ( ) ;
113
- }
114
-
115
- this . #callbacks. clear ( ) ;
110
+ this . commit ( ) ;
116
111
117
112
flush_queued_effects ( render_effects ) ;
118
113
flush_queued_effects ( effects ) ;
@@ -174,12 +169,25 @@ export class Batch {
174
169
fn ( ) ;
175
170
}
176
171
172
+ commit ( ) {
173
+ // commit changes
174
+ for ( const fn of this . #callbacks) {
175
+ fn ( ) ;
176
+ }
177
+
178
+ this . #callbacks. clear ( ) ;
179
+ }
180
+
177
181
increment ( ) {
178
182
this . #pending += 1 ;
179
183
}
180
184
181
185
decrement ( ) {
182
186
this . #pending -= 1 ;
187
+
188
+ if ( this . #pending === 0 ) {
189
+ this . commit ( ) ;
190
+ }
183
191
}
184
192
185
193
settled ( ) {
Original file line number Diff line number Diff line change @@ -2,11 +2,6 @@ import { flushSync } from 'svelte';
2
2
import { test } from '../../test' ;
3
3
4
4
export default test ( {
5
- html : `
6
- <button>show</button>
7
- <p>pending</p>
8
- ` ,
9
-
10
5
async test ( { assert, target } ) {
11
6
const button = target . querySelector ( 'button' ) ;
12
7
You can’t perform that action at this time.
0 commit comments