From c5ba85f9298304bb2342d611e96284ea404563aa Mon Sep 17 00:00:00 2001 From: Hanzalah Waheed Date: Wed, 8 Oct 2025 20:48:54 +0530 Subject: [PATCH] fix(ui): create a var to check for shared metadata obj (#2040) --- frontend/src/agents/SharedAgentCard.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/agents/SharedAgentCard.tsx b/frontend/src/agents/SharedAgentCard.tsx index 46988979..a2b02c87 100644 --- a/frontend/src/agents/SharedAgentCard.tsx +++ b/frontend/src/agents/SharedAgentCard.tsx @@ -2,6 +2,12 @@ import AgentImage from '../components/AgentImage'; import { Agent } from './types'; export default function SharedAgentCard({ agent }: { agent: Agent }) { + // Check if shared metadata exists and has properties (type is 'any' so we validate it's a non-empty object) + const hasSharedMetadata = + agent.shared_metadata && + typeof agent.shared_metadata === 'object' && + agent.shared_metadata !== null && + Object.keys(agent.shared_metadata).length > 0; return (
@@ -20,7 +26,7 @@ export default function SharedAgentCard({ agent }: { agent: Agent }) {

- {agent.shared_metadata && ( + {hasSharedMetadata && (
{agent.shared_metadata?.shared_by && (