Skip to content

Commit daaa643

Browse files
committed
fix store loading prematurely when multiple updates received
1 parent 852d7fb commit daaa643

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/async-stores/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,11 @@ export const asyncWritable = <S extends Stores, T>(
236236
// required properties
237237
const subscribe = thisStore.subscribe;
238238

239-
const load = () => {
239+
const load = async () => {
240240
const dummyUnsubscribe = thisStore.subscribe(() => {
241241
/* no-op */
242242
});
243+
await loadAll(stores);
243244
return getLoadedValueOrThrow(dummyUnsubscribe);
244245
};
245246

0 commit comments

Comments
 (0)