mirror of
https://github.com/hoornet/vega.git
synced 2026-05-08 13:19:10 -07:00
Fix React error #31 crash from malformed Nostr profiles
Malformed profiles with non-string fields (e.g. nip05: {}) crashed
React's entire render tree in production. Add typeof guards and
profileName() utility across all components that render profile data.
Add ErrorBoundary in main.tsx to show crash details instead of blank screen.
This commit is contained in:
@@ -122,7 +122,8 @@ function QuotePreview({ eventId }: { eventId: string }) {
|
||||
|
||||
if (!event) return null;
|
||||
|
||||
const name = profile?.displayName || profile?.name || shortenPubkey(event.pubkey);
|
||||
const rawName = profile?.displayName || profile?.name;
|
||||
const name = (typeof rawName === "string" ? rawName : null) || shortenPubkey(event.pubkey);
|
||||
const preview = event.content.slice(0, 160) + (event.content.length > 160 ? "…" : "");
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user