Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

perf(citations): make Domains/URLs tab switching instant (keepMounted + memo) (#325)

Gökhan Geyik5976fc05bd84
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx
index a5ac6e1a5..9f6cf92d4 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx
@@ -1,6 +1,6 @@
'use client';
-import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslations } from 'next-intl';
import Image from 'next/image';
import dynamic from 'next/dynamic';
@@ -641,7 +641,7 @@ function KpiCard({
// ─── Tables ───────────────────────────────────────────────────────────────────
-function DomainsTable({ rows }: { rows: CitationDomainRow[] }) {
+const DomainsTable = memo(function DomainsTable({ rows }: { rows: CitationDomainRow[] }) {
if (rows.length === 0) return <EmptyRows />;
return (
@@ -693,9 +693,9 @@ function DomainsTable({ rows }: { rows: CitationDomainRow[] }) {
</TableBody>
</Table>
);
-}
+});
-function UrlsTable({ rows }: { rows: CitationUrlRow[] }) {
+const UrlsTable = memo(function UrlsTable({ rows }: { rows: CitationUrlRow[] }) {
if (rows.length === 0) return <EmptyRows />;
return (
@@ -745,7 +745,7 @@ function UrlsTable({ rows }: { rows: CitationUrlRow[] }) {
</TableBody>
</Table>
);
-}
+});
function EmptyRows() {
return (
@@ -954,10 +954,12 @@ export default function CitationsPage() {
{t('tabUrls')} ({data?.totals.urls ?? 0})
</TabsTrigger>
</TabsList>
- <TabsContent value="domains" className="mt-4">
+ {/* keepMounted: data is already in memory, so mount both panels
+ once and make switching a pure CSS visibility toggle (#299). */}
+ <TabsContent value="domains" keepMounted className="mt-4">
<DomainsTable rows={data?.rows ?? []} />
</TabsContent>
- <TabsContent value="urls" className="mt-4">
+ <TabsContent value="urls" keepMounted className="mt-4">
<UrlsTable rows={data?.urlRows ?? []} />
</TabsContent>
</Tabs>