@ -1,5 +1,6 @@
/** @import { Derived, Effect, Source } from '#client' */
/** @import { Derived, Effect, Source } from '#client' */
/** @import { Batch } from './batch.js'; */
/** @import { Batch } from './batch.js'; */
/** @import { Boundary } from '../dom/blocks/boundary.js'; */
import { DEV } from 'esm-env' ;
import { DEV } from 'esm-env' ;
import {
import {
ERROR _VALUE ,
ERROR _VALUE ,
@ -145,11 +146,13 @@ export function async_derived(fn, label, location) {
var batch = /** @type {Batch} */ ( current _batch ) ;
var batch = /** @type {Batch} */ ( current _batch ) ;
// we only increment the batch's pending state for updates, not creation, otherwise
if ( should _suspend ) {
// we will decrement to zero before the work that depends on this promise (e.g. a
// we only increment the batch's pending state for updates, not creation, otherwise
// template effect) has initialized, causing the batch to resolve prematurely
// we will decrement to zero before the work that depends on this promise (e.g. a
if ( should _suspend && ( effect . f & REACTION _RAN ) !== 0 ) {
// template effect) has initialized, causing the batch to resolve prematurely
var decrement _pending = increment _pending ( ) ;
if ( ( effect . f & REACTION _RAN ) !== 0 ) {
var decrement _pending = increment _pending ( ) ;
}
if ( /** @type {Boundary} */ ( parent . b ) . is _rendered ( ) ) {
if ( /** @type {Boundary} */ ( parent . b ) . is _rendered ( ) ) {
deferreds . get ( batch ) ? . reject ( STALE _REACTION ) ;
deferreds . get ( batch ) ? . reject ( STALE _REACTION ) ;