File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
src/internal/client/reactivity
tests/runtime-runes/samples/async-derived-in-if Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,7 @@ export class Batch {
107107 this . render_effects = [ ] ;
108108 this . effects = [ ] ;
109109
110- // commit changes
111- for ( const fn of this . #callbacks) {
112- fn ( ) ;
113- }
114-
115- this . #callbacks. clear ( ) ;
110+ this . commit ( ) ;
116111
117112 flush_queued_effects ( render_effects ) ;
118113 flush_queued_effects ( effects ) ;
@@ -174,12 +169,25 @@ export class Batch {
174169 fn ( ) ;
175170 }
176171
172+ commit ( ) {
173+ // commit changes
174+ for ( const fn of this . #callbacks) {
175+ fn ( ) ;
176+ }
177+
178+ this . #callbacks. clear ( ) ;
179+ }
180+
177181 increment ( ) {
178182 this . #pending += 1 ;
179183 }
180184
181185 decrement ( ) {
182186 this . #pending -= 1 ;
187+
188+ if ( this . #pending === 0 ) {
189+ this . commit ( ) ;
190+ }
183191 }
184192
185193 settled ( ) {
Original file line number Diff line number Diff line change @@ -2,11 +2,6 @@ import { flushSync } from 'svelte';
22import { test } from '../../test' ;
33
44export default test ( {
5- html : `
6- <button>show</button>
7- <p>pending</p>
8- ` ,
9-
105 async test ( { assert, target } ) {
116 const button = target . querySelector ( 'button' ) ;
127
You can’t perform that action at this time.
0 commit comments