fix: server/client error on some dialogs.

This commit is contained in:
charlesgauthereau
2026-01-29 23:11:33 +01:00
parent 95a60e9a96
commit 30b9fc7765
4 changed files with 43 additions and 39 deletions
@@ -1,13 +1,11 @@
import {PageParams} from "@/types/next";
import {AgentCard} from "@/components/wrappers/dashboard/agent/agent-card/agent-card";
import {CardsWithPagination} from "@/components/wrappers/common/cards-with-pagination";
import {Button} from "@/components/ui/button";
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {notFound} from "next/navigation";
import {db} from "@/db";
import * as drizzleDb from "@/db";
import {desc, eq, not} from "drizzle-orm";
import {EmptyStatePlaceholder} from "@/components/wrappers/common/empty-state-placeholder";
import {Metadata} from "next";
import {AgentDialog} from "@/features/agents/components/agent.dialog";
@@ -25,7 +23,6 @@ export default async function RoutePage(props: PageParams<{}>) {
orderBy: (fields) => desc(fields.lastContact),
});
if (!agents) {
notFound();
}
@@ -36,9 +33,7 @@ export default async function RoutePage(props: PageParams<{}>) {
<PageTitle>Agents</PageTitle>
{agents.length > 0 && (
<PageActions>
<AgentDialog>
<Button>+ Create Agent</Button>
</AgentDialog>
<AgentDialog typeTrigger={"create"} />
</PageActions>
)}
</PageHeader>
@@ -46,11 +41,7 @@ export default async function RoutePage(props: PageParams<{}>) {
{agents.length > 0 ? (
<CardsWithPagination data={agents} cardItem={AgentCard} cardsPerPage={4} numberOfColumns={1}/>
) : (
<AgentDialog>
<EmptyStatePlaceholder
text={"Create new Agent"}
/>
</AgentDialog>
<AgentDialog typeTrigger="empty"/>
)}
</PageContent>
</Page>