remove timeout stuff, for now at least

async-changeset
Rich Harris 7 months ago
parent c2c17f6b0c
commit 1c03d00082

@ -2,7 +2,7 @@
/** @import { Context } from '../types' */
import * as e from '../../../errors.js';
const valid = ['onerror', 'failed', 'pending', 'showPendingAfter', 'showPendingFor'];
const valid = ['onerror', 'failed', 'pending'];
/**
* @param {AST.SvelteBoundary} node

@ -32,16 +32,12 @@ 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 { raf } from '../../timing.js';
import { loop } from '../../loop.js';
/**
* @typedef {{
* onerror?: (error: unknown, reset: () => void) => void;
* failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
* pending?: (anchor: Node) => void;
* showPendingAfter?: number;
* showPendingFor?: number;
* }} BoundaryProps
*/
@ -101,7 +97,6 @@ export class Boundary {
#offscreen_fragment = null;
#pending_count = 0;
#keep_pending_snippet = false; // TODO get rid of this
#is_creating_fallback = false;
/**
@ -206,23 +201,6 @@ export class Boundary {
if (this.#pending_effect === null) {
this.#pending_effect = branch(() => pending(this.#anchor));
}
// TODO do we want to differentiate between initial render and updates here?
if (!initial) {
this.#keep_pending_snippet = true;
var end = raf.now() + (this.#props.showPendingFor ?? 300);
loop((now) => {
if (now >= end) {
this.#keep_pending_snippet = false;
this.commit();
return false;
}
return true;
});
}
} else if (this.parent) {
throw new Error('TODO show pending snippet on parent');
} else {
@ -241,7 +219,7 @@ export class Boundary {
}
commit() {
if (this.#keep_pending_snippet || this.#pending_count > 0) {
if (this.#pending_count > 0) {
return;
}
@ -283,25 +261,12 @@ export class Boundary {
}
increment() {
// post-init, show the pending snippet after a timeout
if (!this.suspended && this.ran) {
var start = raf.now();
var end = start + (this.#props.showPendingAfter ?? 500);
loop((now) => {
if (this.#pending_count === 0) return false;
if (now < end) return true;
this.#show_pending_snippet(false);
});
}
this.suspended = true;
this.#pending_count++;
}
decrement() {
if (--this.#pending_count === 0 && !this.#keep_pending_snippet) {
if (--this.#pending_count === 0) {
this.commit();
if (this.#main_effect !== null) {

Loading…
Cancel
Save