fix: prevent [object Object] rendering in 25 frontend components
Replace direct {error} JSX rendering with typeof check + .message fallback.
When error is an object (not a string), React showed [object Object].
Now renders error.message or fallback string.
This commit is contained in:
@@ -179,7 +179,7 @@ export function ChatWindow({ sessionId, agentId, className, compact }: ChatWindo
|
||||
</div>
|
||||
)}
|
||||
<ActivityIndicator status={activity} />
|
||||
{error && <div className="mb-4 text-sm text-red-600">{error}</div>}
|
||||
{error && <div className="mb-4 text-sm text-red-600">{typeof error === "string" ? error : (error as any)?.message || "Ein Fehler ist aufgetreten"}</div>}
|
||||
</div>
|
||||
<div className={clsx('border-t border-secondary-200', compact ? 'p-2' : 'p-4')}>
|
||||
<div className="flex items-end gap-2">
|
||||
|
||||
@@ -347,7 +347,7 @@ export function SessionList({ activeSessionId, onSelectSession, isSidebar, class
|
||||
|
||||
return (
|
||||
<div className={clsx('flex flex-col h-full', className)}>
|
||||
{error && <div className="p-2 text-xs text-red-600">{error}</div>}
|
||||
{error && <div className="p-2 text-xs text-red-600">{typeof error === "string" ? error : (error as any)?.message || "Ein Fehler ist aufgetreten"}</div>}
|
||||
<div
|
||||
className="flex-1 overflow-y-auto p-2"
|
||||
onContextMenu={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user