Skip to content

Commit

Permalink
fix store loading prematurely when multiple updates received
Browse files Browse the repository at this point in the history
  • Loading branch information
Akolyte01 committed Aug 16, 2023
1 parent 852d7fb commit daaa643
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/async-stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,11 @@ export const asyncWritable = <S extends Stores, T>(
// required properties
const subscribe = thisStore.subscribe;

const load = () => {
const load = async () => {
const dummyUnsubscribe = thisStore.subscribe(() => {
/* no-op */
});
await loadAll(stores);
return getLoadedValueOrThrow(dummyUnsubscribe);
};

Expand Down

0 comments on commit daaa643

Please sign in to comment.