fix: let useUserById accept undefined userId (#648)
This commit is contained in:
parent
0c328bc398
commit
a93e64c830
|
@ -46,7 +46,7 @@ export const usePrivateUser = (userId?: string) => {
|
||||||
return privateUser
|
return privateUser
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useUserById = (userId: string) => {
|
export const useUserById = (userId = '_') => {
|
||||||
const result = useFirestoreDocumentData<DocumentData, User>(
|
const result = useFirestoreDocumentData<DocumentData, User>(
|
||||||
['users', userId],
|
['users', userId],
|
||||||
doc(users, userId),
|
doc(users, userId),
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default function ClaimPage() {
|
||||||
const [claiming, setClaiming] = useState(false)
|
const [claiming, setClaiming] = useState(false)
|
||||||
const [error, setError] = useState<string | undefined>(undefined)
|
const [error, setError] = useState<string | undefined>(undefined)
|
||||||
|
|
||||||
const fromUser = useUserById(manalink?.fromId ?? '_loading')
|
const fromUser = useUserById(manalink?.fromId)
|
||||||
if (!manalink) {
|
if (!manalink) {
|
||||||
return <></>
|
return <></>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user