fix(app): redirect archived agent screen to draft

This commit is contained in:
Mohamed Boudra
2026-02-19 13:03:53 +07:00
parent 1473820cc4
commit 7d1122a371
@@ -569,6 +569,23 @@ function AgentScreenContent({
resolvedAgentId &&
isArchivingAgent({ serverId, agentId: resolvedAgentId })
);
const hasRedirectedArchivedAgentRef = useRef(false);
useEffect(() => {
if (!resolvedAgentId) {
hasRedirectedArchivedAgentRef.current = false;
return;
}
if (!agent?.archivedAt) {
hasRedirectedArchivedAgentRef.current = false;
return;
}
if (hasRedirectedArchivedAgentRef.current) {
return;
}
hasRedirectedArchivedAgentRef.current = true;
router.replace(buildHostAgentDraftRoute(serverId) as any);
}, [agent?.archivedAt, resolvedAgentId, router, serverId]);
useEffect(() => {
if (!resolvedAgentId) {