PronounDB: Fix crash

This commit is contained in:
V 2023-06-29 14:28:16 +02:00
parent 088a8bd1b6
commit e12c0e546c
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905

View File

@ -66,14 +66,14 @@ export function useFormattedPronouns(id: string): string | null {
// Discord is so stupid you can put tons of newlines in pronouns
const discordPronouns = getDiscordPronouns(id)?.trim().replace(NewLineRe, " ");
if (settings.store.pronounSource === PronounSource.PreferDiscord && discordPronouns)
return discordPronouns;
const [result] = useAwaiter(() => fetchPronouns(id), {
fallbackValue: getCachedPronouns(id),
onError: e => console.error("Fetching pronouns failed: ", e)
});
if (settings.store.pronounSource === PronounSource.PreferDiscord && discordPronouns)
return discordPronouns;
if (result && result !== "unspecified")
return formatPronouns(result);