fix(fe): crash 'reading charAt' on message avatar fallback
Build & Deploy (Nix) / build-and-deploy (backend) (push) Successful in 2m47s
Build & Deploy (Nix) / build-and-deploy (discord-gateway) (push) Successful in 3m2s
Build & Deploy (Nix) / build-and-deploy (proxy) (push) Successful in 3m19s
Build & Deploy (Nix) / build-and-deploy (backend) (push) Successful in 2m47s
Build & Deploy (Nix) / build-and-deploy (discord-gateway) (push) Successful in 3m2s
Build & Deploy (Nix) / build-and-deploy (proxy) (push) Successful in 3m19s
msg.username bisa undefined saat pesan live masuk lewat WS (message_updated Partial payload / capture tidak lengkap) -> msg.username.charAt(0) TypeError, halaman /messages mati. - message-card + search-panel: username?.charAt(0) ?? '?' - created_at di-guard juga biar tidak render 'Invalid Date' Verifikasi: tsc PASS, build PASS, biome 0 error. DB saat ini 0 row null username (1176 total) — crash murni dari jalur WS live.
This commit is contained in:
@@ -70,7 +70,7 @@ export function SearchPanel() {
|
|||||||
<Avatar className="size-8 shrink-0 mt-0.5">
|
<Avatar className="size-8 shrink-0 mt-0.5">
|
||||||
<AvatarImage src={msg.avatar_url ?? undefined} />
|
<AvatarImage src={msg.avatar_url ?? undefined} />
|
||||||
<AvatarFallback className="text-xs">
|
<AvatarFallback className="text-xs">
|
||||||
{msg.username.charAt(0).toUpperCase()}
|
{msg.username?.charAt(0).toUpperCase() ?? "?"}
|
||||||
</AvatarFallback>
|
</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<div className="flex-1 min-w-0 space-y-2">
|
<div className="flex-1 min-w-0 space-y-2">
|
||||||
@@ -79,7 +79,9 @@ export function SearchPanel() {
|
|||||||
{msg.username}
|
{msg.username}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-xs text-muted-foreground">
|
<span className="text-xs text-muted-foreground">
|
||||||
{new Date(msg.created_at).toLocaleString()}
|
{msg.created_at
|
||||||
|
? new Date(msg.created_at).toLocaleString()
|
||||||
|
: ""}
|
||||||
</span>
|
</span>
|
||||||
{msg.ai_status && (
|
{msg.ai_status && (
|
||||||
<Badge
|
<Badge
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ import { Badge } from "@/components/ui/badge";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { Progress } from "@/components/ui/progress";
|
import { Progress } from "@/components/ui/progress";
|
||||||
import { safeParseJsonArray, getMessageChannelLabel, renderMessageContent } from "@/lib/format";
|
import {
|
||||||
|
getMessageChannelLabel,
|
||||||
|
renderMessageContent,
|
||||||
|
safeParseJsonArray,
|
||||||
|
} from "@/lib/format";
|
||||||
import type { MessageRecord } from "@/lib/types";
|
import type { MessageRecord } from "@/lib/types";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { AiStatusBadge } from "./ai-status-badge";
|
import { AiStatusBadge } from "./ai-status-badge";
|
||||||
@@ -43,14 +47,16 @@ export function MessageCard({
|
|||||||
<Avatar className="size-8 shrink-0 mt-0.5">
|
<Avatar className="size-8 shrink-0 mt-0.5">
|
||||||
<AvatarImage src={msg.avatar_url ?? undefined} />
|
<AvatarImage src={msg.avatar_url ?? undefined} />
|
||||||
<AvatarFallback className="text-xs">
|
<AvatarFallback className="text-xs">
|
||||||
{msg.username.charAt(0).toUpperCase()}
|
{msg.username?.charAt(0).toUpperCase() ?? "?"}
|
||||||
</AvatarFallback>
|
</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<div className="flex-1 min-w-0 space-y-2">
|
<div className="flex-1 min-w-0 space-y-2">
|
||||||
<div className="flex items-center gap-2 flex-wrap">
|
<div className="flex items-center gap-2 flex-wrap">
|
||||||
<span className="text-sm font-medium">{msg.username}</span>
|
<span className="text-sm font-medium">{msg.username}</span>
|
||||||
<span className="text-xs text-muted-foreground">
|
<span className="text-xs text-muted-foreground">
|
||||||
{new Date(msg.created_at).toLocaleString()}
|
{msg.created_at
|
||||||
|
? new Date(msg.created_at).toLocaleString()
|
||||||
|
: ""}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="text-xs text-muted-foreground"
|
className="text-xs text-muted-foreground"
|
||||||
|
|||||||
Reference in New Issue
Block a user