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.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(web): count topic prompts by topic_id instead of category name (#617)
Patel Dhrit5ba5ce97abf1
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/topics/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/topics/page.tsxindex a73e02858..f8732d65c 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/topics/page.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/topics/page.tsx@@ -54,7 +54,7 @@ export default function BrandTopicsPage({ params }: PageProps) {const counts: Record<string, number> = {};await Promise.all(data.map(async (t) => {- counts[t.id] = await getPromptCountByTopic(brandId, t.name);+ counts[t.id] = await getPromptCountByTopic(brandId, t.id);}),);if (isCancelled?.()) return;diff --git a/web/src/lib/actions/topic.ts b/web/src/lib/actions/topic.tsindex be05222bb..1e0d4fcb9 100644--- a/web/src/lib/actions/topic.ts+++ b/web/src/lib/actions/topic.ts@@ -95,7 +95,7 @@ export async function updateTopic(topicId: string, name: string): Promise<Topic>return mapTopicRow(data as Record<string, unknown>);}-export async function getPromptCountByTopic(brandId: string, topicName: string): Promise<number> {+export async function getPromptCountByTopic(brandId: string, topicId: string): Promise<number> {const supabase = await createClient();const { data: sets } = await supabase.from('prompt_sets').select('id').eq('brand_id', brandId);@@ -107,7 +107,7 @@ export async function getPromptCountByTopic(brandId: string, topicName: string):.from('prompts').select('id', { count: 'exact', head: true }).in('prompt_set_id', setIds)- .eq('category', topicName);+ .eq('topic_id', topicId);if (error) throw new Error(error.message);return count ?? 0;