diff --git a/src/lib/stores/repo.ts b/src/lib/stores/repo.ts index c06ab33..0422cfb 100644 --- a/src/lib/stores/repo.ts +++ b/src/lib/stores/repo.ts @@ -52,7 +52,7 @@ export const awaitSelectedRepoCollection = async ( !repo_collection.loading ) { setTimeout(() => { - unsubscriber() + if (unsubscriber) unsubscriber() }, 5) r({ ...repo_collection }) } diff --git a/src/lib/stores/repos.ts b/src/lib/stores/repos.ts index 9a075e3..c0a4e50 100644 --- a/src/lib/stores/repos.ts +++ b/src/lib/stores/repos.ts @@ -25,7 +25,9 @@ export const returnRepoCollection = async ( unique_commit_or_identifier ).subscribe((c) => { if (!c.loading) { - unsubscriber() + setTimeout(() => { + if (unsubscriber) unsubscriber() + }, 5) r(c) } }) diff --git a/src/lib/stores/users.ts b/src/lib/stores/users.ts index 4489b9f..2d4d28a 100644 --- a/src/lib/stores/users.ts +++ b/src/lib/stores/users.ts @@ -49,7 +49,9 @@ export const returnUser = async (hexpubkey: string): Promise => { return new Promise((r) => { const unsubscriber = ensureUser(hexpubkey).subscribe((u) => { if (!u.loading) { - unsubscriber() + setTimeout(() => { + if (unsubscriber) unsubscriber() + }, 5) r(u) } }) @@ -123,7 +125,9 @@ export const getUserRelays = async (hexpubkey: string): Promise => { (querying_user_relays) => { if (querying_user_relays && !querying_user_relays.loading) { res(querying_user_relays) - if (unsubscriber) unsubscriber() + setTimeout(() => { + if (unsubscriber) unsubscriber() + }, 5) } } )