elliott/resources
Elliott Johnson 2 weeks ago
parent 82be3881b2
commit 25210c2cfa

@ -1,5 +1,5 @@
/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
/** @import { Hydratable, Transport } from '#shared' */
/** @import { Transport } from '#shared' */
import { DEV } from 'esm-env';
import * as e from './errors.js';
import { active_effect, active_reaction } from './runtime.js';

@ -24,7 +24,7 @@ export class Resource {
/** @type {Source<T | undefined>} */
#raw = state(undefined);
/** @type {Source<Promise<void>>} */
/** @type {Source<Promise<any>>} */
#promise;
/** @type {Derived<T | undefined>} */
@ -149,10 +149,10 @@ export class Resource {
/**
* @returns {Promise<void>}
*/
refresh = () => {
refresh = async () => {
const promise = this.#run();
set(this.#promise, promise);
return promise;
await promise;
};
/**

Loading…
Cancel
Save