Repository navigation
feat(prompts): move Topics into the Prompts area as its Topics tab - #1107
Merged
Merged
Conversation
…time out The Topics page failed to load on the largest brand: its overview, topics_overview_aggregates (00057, 00098), scans 30 days of answers as the caller under RLS and ran past the authenticated role's 8 s statement timeout, so the request ended in a 500 after ~9 s and the page read "Failed to load topics". Migration 00156 adds topics_overview_window(brand, from, to): a window under two days reads its answers directly; a longer one reads whole UTC days from the rollups the Insights page reads (insights_prompt_daily, insights_competitor_prompt_daily), and each topic's last answer from the covering index. It is plpgsql with force_custom_plan and work_mem, and security definer with the organization check made explicit, as 00152 and 00153 are. The change compares the window with the one of the same length before it, and the trend has a point per day (none under two days, where the cell shows only the change). The page gets the Prompts page's date range (24h, 7d, 30d, 90d, custom), opening on 24 hours. Custom dates read as whole UTC days, a newer range's answer is never overwritten by an older one's, the roster and the aggregate are read in parallel, and the CSV names its range. A web build deployed before the migration falls back to the old function (PGRST202). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Topics becomes the Prompts page's second tab (Prompts, Topics, Query Fan-out, Insights) at /dashboard/prompts/topics, and a child of the sidebar's Prompts submenu under Prompt Suggestions. The top-level Topics item goes; /dashboard/topics and /dashboard/topics/<id> redirect to the new routes, and in-app links (Insights heat map, Action Center topic contexts, the topic page's back button, revalidatePath) point there. The tab shares the page's date range (24h by default) and hides Location, which doesn't apply to topics. It loads as its own chunk only when shown, and the page holds back the prompts table's reads until the topics are in or another tab opens, so the other tabs' first load is unchanged. Tab and view switches write their route before the next tab mounts: Next 16.1.6 drops server actions queued behind a history "restore" that lands while one is in flight. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
This was referenced Oct 16, 2026
…-range Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…topic Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sidebar drops its Topics item and keeps main's Mentions item. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
gkhngyk
approved these changes
Oct 17, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Reviewed. Merged main into the branch: the sidebar drops its Topics item for the Prompts submenu entry and keeps main's Mentions item. /dashboard/topics and /dashboard/topics/[id] redirect the way the other dashboard redirects do. Tested on the full prompts chain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Topics moves into the Prompts area as its second tab, at
/dashboard/prompts/topics. The old address keeps working through a redirect.What changes
/dashboard/prompts/topicsis the new route. It re-exports the Prompts page, liketracked,suggestions,fan-outsandinsights(PROMPT-001).lib/prompts-routes.tsgains the section./dashboard/prompts/topics/<id>./dashboard/topicsand/dashboard/topics/<id>redirect there, so bookmarks, shared links and older builds keep working.revalidatePathafter accepting a topic suggestion;guides/topics.mdx,concepts/topics-and-prompts.mdx).next/dynamic), only when it is shown.showSection).history.replaceStateinto a router "restore". A restore that lands while a server action is in flight leaves the action queue pointing at the discarded action, so the actions queued after it never run, and the table spins forever.nav.topics). The old page's own header keys (topics.title,topics.description) are removed.Known limit
Related issue
None. Follows #1106.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
/dashboard/topics. It lands on/dashboard/prompts/topics:?range=./dashboard/prompts/topics/<id>, and Topics returns to the tab. An old/dashboard/topics/<id>link lands on the same page.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): no errors; the 7 warnings are in files this PR does not touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
web:yarn test(864) andyarn buildpass.Tests:
topics/page.test.ts: both redirects, and an id staying within its own path segment;lib/prompts-routes.test.ts: the topics section, and a topic's page not counted as a section;lib/dashboard-navigation.test.ts: the Prompts children's order and Topics' route, and no top-level/dashboard/topics.In the browser, on a production build with demo data:
Review: a code review raised these, now fixed:
The Next.js stall is noted above.
🤖 Generated with Claude Code