Skip to content

fix(prompts): move suggestions to All Prompts - #466

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
Dodothereal:fix/461-prompts-move-the-prompt-suggestions-card
Jul 17, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
Dodothereal:fix/461-prompts-move-the-prompt-suggestions-card

Conversation

@Dodothereal

Copy link
Copy Markdown
Contributor

fix(prompts): move suggestions to All Prompts

Summary

Moves the Prompt Suggestions card from the Insights tab to the top of All Prompts, where suggested prompts can be acted on alongside the tracked prompt list. The card now exposes a stable anchor for direct navigation.

Fixes #461

Changes

  • Render SuggestionsCard first in the All Prompts tab and remove it from Insights.
  • Add the prompt-opportunities anchor ID to the suggestions card.

Testing

Ran in the required isolated sandbox from repo/:

sandbox-run "cd web && yarn install --frozen-lockfile && yarn lint && yarn typecheck && yarn format:check"

All commands passed. yarn lint completed with 9 pre-existing warnings and no errors.


AI assistance disclosure

This contribution was produced by an autonomous AI coding agent (Claude Code) that @Dodothereal operates and monitors. @Dodothereal is accountable for it, will address review feedback promptly, and will close this PR immediately if this kind of contribution is unwelcome in this project. Commits carry an Assisted-by: Claude Code trailer.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The move itself is right (render-first on All Prompts, removed from Insights, anchor id added) — but relocating this card changes its cost profile and leaves two #461 acceptance criteria unmet:

1. The card now auto-fires LLM generation on the product's hottest path.
SuggestionsCard mounts with load(true), which auto-calls refreshPromptSuggestions (a POST that generates via LLM) whenever the server marks the stored set stale. On the Insights tab that cost was gated behind opening a secondary tab; on All Prompts — the default tab — it now fires on every Prompts page visit once suggestions go stale. Issue #461 said "no changes to the card's internals", but the move itself makes this internal necessary: please change the mount call to load(false) so stale suggestions render as-is and generation only happens via the explicit Refresh / Generate buttons. (Same principle as #459/#463: no LLM calls in a page's load path.)

2. Accepting a suggestion doesn't update the tracked list below (AC: "inserts it into the tracked list below and refreshes it").
handleAccept removes the item from the card's own state, but the prompt table on the same tab is page-level state and won't show the new prompt until a manual reload — visibly inconsistent now that both live on one screen. Add an optional onAccepted?: () => void prop to SuggestionsCard, call it after a successful accept, and have PromptsPage pass its prompt-reload function.

3. Cold-load anchor scroll (AC: "scrolls to the card, including on a cold page load").
The card renders after async loading, so the browser's native hash scroll misses it. A small effect that re-applies the hash once content is mounted covers it, e.g. in the card: useEffect(() => { if (!loading && window.location.hash === '#prompt-opportunities') document.getElementById('prompt-opportunities')?.scrollIntoView(); }, [loading]);

All three are small; happy to re-review quickly.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three verified in the new commits:

  1. ✅ Mount now calls load(false) — stale suggestions render as-is and generation only happens via the explicit Refresh / Generate buttons. No LLM on the page's load path.
  2. ✅ onAccepted prop wired to the page's loadData, so accepting a suggestion refreshes the tracked list on the same screen.
  3. ✅ Hash-scroll effect re-applies #prompt-opportunities once the card content mounts — cold-load deep links work.

CI green. LGTM, thanks for the quick turnaround!

@gkhngyk
gkhngyk merged commit 44e0d5e into ansvisor:main Jul 17, 2026
3 checks passed
gkhngyk added a commit that referenced this pull request Jul 17, 2026
…efault (#470)

At the top of All Prompts the expanded suggestions card (~400px) pushed
the prompt table below the fold on every visit. Collapse it to a single
header row by default — chevron + title + count badge — so the table is
back above the fold while the suggestions stay discoverable at the top.

- Expanding/collapsing persists per browser via localStorage.
- The #prompt-opportunities deep link auto-expands (without touching the
  stored preference) before scrolling into view.
- Refresh button and card content render only when expanded; collapsed
  header shows a small spinner while loading and a count badge after.

Related to #461/#466 (placement feedback follow-up).
gkhngyk added a commit that referenced this pull request Jul 18, 2026
Since the suggestions card moved to the All Prompts tab (#466) it fired
its server action on every page mount — and as the FIRST entry in
Next's serialized action queue. Any hiccup in that request (the
router-state-header framework issue, a slow upstream) stalled the
prompt table's own data fetch queued behind it: the exact regression
window the user identified — 'this never happened before the card
moved'.

The collapsed strip now costs zero requests. Suggestions are fetched
the first time the card is actually expanded (or via the
#prompt-opportunities deep link, which auto-expands); the count badge
appears once loaded, and the strip shows a neutral 'expand for AI
prompt ideas' hint before that. Page load is back to exactly one
server action — the table's — like before the move.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompts: move the Prompt Suggestions card to the top of the All Prompts tab

2 participants