pull/16197/head
Rich Harris 6 months ago
parent b48c12b859
commit e247f665af

@ -24,6 +24,7 @@ import { queue_boundary_micro_task } from '../task.js';
import * as e from '../../../shared/errors.js';
import { DEV } from 'esm-env';
import { from_async_derived, set_from_async_derived } from '../../reactivity/deriveds.js';
import { active_fork, Fork } from '../../reactivity/forks.js';
/**
* @typedef {{
@ -114,6 +115,7 @@ export class Boundary {
// boundary, and hydrate accordingly
queueMicrotask(() => {
this.#main_effect = this.#run(() => {
Fork.ensure();
return branch(() => this.#children(this.#anchor));
});

@ -1,4 +1,5 @@
/** @import { Derived, Effect, Source } from '#client' */
/** @import { Fork } from './forks.js'; */
import { DEV } from 'esm-env';
import {
CLEAN,
@ -123,14 +124,14 @@ export function async_derived(fn, location) {
var restore = capture();
var fork = active_fork;
var fork = /** @type {Fork} */ (active_fork);
var ran = boundary.ran;
if (should_suspend) {
if (!ran) {
boundary.increment();
} else {
fork?.increment();
fork.increment();
}
}
@ -147,17 +148,13 @@ export function async_derived(fn, location) {
if (!ran) {
boundary.decrement();
} else {
fork?.decrement();
fork.decrement();
}
}
if (fork !== null) {
fork.run(() => {
internal_set(signal, v);
});
} else {
fork.run(() => {
internal_set(signal, v);
}
});
if (DEV && location !== undefined) {
recent_async_deriveds.add(signal);

Loading…
Cancel
Save