fix: let useUserById accept undefined userId (#648)

This commit is contained in:
Sinclair Chen 2022-07-14 10:02:46 -07:00 committed by GitHub
parent 0c328bc398
commit a93e64c830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ export const usePrivateUser = (userId?: string) => {
return privateUser
}
export const useUserById = (userId: string) => {
export const useUserById = (userId = '_') => {
const result = useFirestoreDocumentData<DocumentData, User>(
['users', userId],
doc(users, userId),

View File

@ -17,7 +17,7 @@ export default function ClaimPage() {
const [claiming, setClaiming] = useState(false)
const [error, setError] = useState<string | undefined>(undefined)
const fromUser = useUserById(manalink?.fromId ?? '_loading')
const fromUser = useUserById(manalink?.fromId)
if (!manalink) {
return <></>
}