@@ -10,7 +10,7 @@ import {
1010 set_hydrating
1111} from '../hydration.js' ;
1212import { queue_micro_task } from '../task.js' ;
13- import { HYDRATION_START_ELSE } from '../../../../constants.js' ;
13+ import { HYDRATION_START_ELSE , UNINITIALIZED } from '../../../../constants.js' ;
1414import { is_runes } from '../../context.js' ;
1515import { flushSync , is_flushing_sync } from '../../reactivity/batch.js' ;
1616import { BranchManager } from './branches.js' ;
@@ -38,10 +38,9 @@ export function await_block(node, get_input, pending_fn, then_fn, catch_fn) {
3838
3939 var runes = is_runes ( ) ;
4040
41- var input_source = runes
42- ? source ( /** @type {V } */ ( undefined ) )
43- : mutable_source ( /** @type {V } */ ( undefined ) , false , false ) ;
44- var error_source = runes ? source ( undefined ) : mutable_source ( undefined , false , false ) ;
41+ var v = /** @type {V } */ ( UNINITIALIZED ) ;
42+ var value = runes ? source ( v ) : mutable_source ( v , false , false ) ;
43+ var error = runes ? source ( v ) : mutable_source ( v , false , false ) ;
4544
4645 var branches = new BranchManager ( node ) ;
4746
@@ -90,20 +89,20 @@ export function await_block(node, get_input, pending_fn, then_fn, catch_fn) {
9089 } ;
9190
9291 input . then (
93- ( value ) => {
92+ ( v ) => {
9493 resolve ( ( ) => {
95- internal_set ( input_source , value ) ;
96- branches . ensure ( THEN , then_fn && ( ( target ) => then_fn ( target , input_source ) ) ) ;
94+ internal_set ( value , v ) ;
95+ branches . ensure ( THEN , then_fn && ( ( target ) => then_fn ( target , value ) ) ) ;
9796 } ) ;
9897 } ,
99- ( error ) => {
98+ ( e ) => {
10099 resolve ( ( ) => {
101- internal_set ( error_source , error ) ;
102- branches . ensure ( THEN , catch_fn && ( ( target ) => catch_fn ( target , error_source ) ) ) ;
100+ internal_set ( error , e ) ;
101+ branches . ensure ( THEN , catch_fn && ( ( target ) => catch_fn ( target , error ) ) ) ;
103102
104103 if ( ! catch_fn ) {
105104 // Rethrow the error if no catch block exists
106- throw error_source . v ;
105+ throw error . v ;
107106 }
108107 } ) ;
109108 }
@@ -123,8 +122,8 @@ export function await_block(node, get_input, pending_fn, then_fn, catch_fn) {
123122 } ) ;
124123 }
125124 } else {
126- internal_set ( input_source , input ) ;
127- branches . ensure ( THEN , then_fn && ( ( target ) => then_fn ( target , input_source ) ) ) ;
125+ internal_set ( value , input ) ;
126+ branches . ensure ( THEN , then_fn && ( ( target ) => then_fn ( target , value ) ) ) ;
128127 }
129128
130129 if ( mismatch ) {
0 commit comments