Skip to content

Commit

Permalink
fix for react native event loop, hope works fine now
Browse files Browse the repository at this point in the history
  • Loading branch information
postrockreverb committed Apr 8, 2024
1 parent 52e2539 commit c8ac9fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/derived.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export function derived<StoreType>(valueGetter: ValueGetter<StoreType>): Derived

async function computeValue() {
const newValue = valueGetter(get);
value = await newValue;
if (newValue instanceof Promise) {
value = await newValue;
} else {
value = newValue;
}
subscribers.forEach((callback) => callback(value));
}

Expand Down

0 comments on commit c8ac9fc

Please sign in to comment.