File tree Expand file tree Collapse file tree 4 files changed +38
-1
lines changed
src/internal/client/dom/blocks
tests/runtime-runes/samples/error-boundary-23 Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' svelte ' : patch
3+ ---
4+
5+ fix: flush pending changes after rendering ` failed ` snippet
Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ import {
3030 skip_nodes ,
3131 set_hydrate_node
3232} from '../hydration.js' ;
33- import { get_next_sibling } from '../operations.js' ;
3433import { queue_micro_task } from '../task.js' ;
3534import * as e from '../../errors.js' ;
3635import * as w from '../../warnings.js' ;
@@ -402,6 +401,7 @@ export class Boundary {
402401 if ( failed ) {
403402 queue_micro_task ( ( ) => {
404403 this . #failed_effect = this . #run( ( ) => {
404+ Batch . ensure ( ) ;
405405 this . #is_creating_fallback = true ;
406406
407407 try {
Original file line number Diff line number Diff line change 1+ import { tick } from 'svelte' ;
2+ import { test } from '../../test' ;
3+
4+ export default test ( {
5+ async test ( { assert, target, logs } ) {
6+ const btn = target . querySelector ( 'button' ) ;
7+ btn ?. click ( ) ;
8+ await tick ( ) ;
9+
10+ assert . deepEqual ( logs , [ 'attachment' ] ) ;
11+ }
12+ } ) ;
Original file line number Diff line number Diff line change 1+ <script >
2+ let fail = $state (false );
3+
4+ function error () {
5+ throw new Error (' oops' );
6+ }
7+
8+ function attachment () {
9+ console .log (' attachment' );
10+ }
11+ </script >
12+
13+ <svelte:boundary >
14+ {fail ? error () : ' all good' }
15+ <button onclick ={() => fail = true }>fail</button >
16+
17+ {#snippet failed ()}
18+ <div {@attach attachment }>oops!</div >
19+ {/ snippet }
20+ </svelte:boundary >
You can’t perform that action at this time.
0 commit comments