Browse Source

fix(user): ensureUser with empty hexpubkey crash

which caused issue:
nostr:note10kkr6mnj0wulfpenqeq02rzraxfj6yttk8lnfkz6lau9w7jeqldsjjwfla
master
DanConwayDev 2 years ago
parent
commit
dffcb7770e
No known key found for this signature in database
GPG Key ID: 68E15486D73F75E1
  1. 7
      src/lib/stores/users.ts

7
src/lib/stores/users.ts

@ -8,7 +8,14 @@ import { ndk } from './ndk' @@ -8,7 +8,14 @@ import { ndk } from './ndk'
export const users: { [hexpubkey: string]: Writable<UserObject> } = {}
let empty_user: Writable<UserObject> = writable({
loading: true,
hexpubkey:'',
npub: "npub...",
})
export const ensureUser = (hexpubkey: string): Writable<UserObject> => {
if (hexpubkey === '') return empty_user;
if (!users[hexpubkey]) {
const u = ndk.getUser({ hexpubkey })

Loading…
Cancel
Save