Skip to content

Wire the hero search to a /search results page - #7

Draft
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixhome-wire-hero-search-to-a-results-e32739
Draft

posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixhome-wire-hero-search-to-a-results-e32739

Conversation

@posthog-eu

@posthog-eu posthog-eu Bot commented Aug 15, 2026

Copy link
Copy Markdown

Problem

  • Every visitor sees a headline search box ("Search your learning in plain English") that does nothing — the platform's marquee feature is a dead text field.
  • components/home/hero.tsx rendered a bare SearchInput: no form, no submit handler, no target. There was no /search route, and nothing linked to one.
  • The search backend in app/api/search and lib/search is complete but was unreachable from the UI. The results page was deferred in prompts/intelligent-search.md; this PR finishes that wiring.

Changes

  • Navigate on submit. A new SearchForm — a native <form action="/search" method="get"> around SearchInput (name="q") — so the box works without client JavaScript. The hero now uses it.
  • Render the results. A new /search page reads q and hands off to a SearchResults client component that posts to /api/search and renders the ranked video and lesson cards, reusing the existing LessonVideoCard/LessonCard.
  • Per AGENTS.md §11: a "Found N results across M courses" count, a sort control defaulting to Most Relevant, and loading / error / empty states (the empty state links to the catalog).

Boundaries per AGENTS.md §5 are kept: the browser holds no token and only calls the server route; sorting re-runs the search because the route owns ordering.

Not included: the PostHog localhost capture guard

The report also flags instrumentation-client.ts capturing local dev exceptions into the shared project. Draft #6 already changes that file to capture_exceptions: process.env.NODE_ENV === "production" — exactly the development-host guard the report asks for. Duplicating it here would conflict with #6, so this PR leaves that file to #6 and is scoped to the search wiring, the part that actually costs users.

Why

The reported exception (ReferenceError: SearchForm is not defined) was one-off local dev noise from this feature's aborted work-in-progress. The lasting cost is that search — the product's headline feature — could not be reached from the UI at all.

Test

  1. npm run lint — passes.
  2. npm run typecheck — passes.
  3. npm run build — compiles and generates route types; page-data collection needs real SANITY_API_READ_TOKEN (unrelated to this change, same limit noted in Filter ClerkJS network-noise exceptions before PostHog capture #6).
  4. Dev server: /search returns 200 and renders the form, the empty prompt, and the loading state; /search?q=... prefills the box. /'s only failure is the placeholder Sanity token.
Not verified live

Rendering real result cards needs a real Sanity dataset, an OpenAI key, and a deployed Studio for the Context MCP — none available in this environment. The client fetch, states, and card mapping are wired against the existing SearchResponse contract but were not exercised against a live search.


Created with PostHog Desktop from this inbox report.

The home hero search box had no form, no submit handler, and no target: the
search backend in app/api/search and lib/search was complete but unreachable,
so the platform's headline feature was a dead text field.

Add a shared SearchForm (a native GET form to /search), point the hero at it,
and build the /search page. A SearchResults client component posts the query to
the existing search API and renders the ranked video and lesson cards with a
result count and a sort control, plus loading, error, and empty states.

Generated-By: PostHog Desktop
Task-Id: 5ffab73a-df56-4362-a2b1-6adc8c1ce730
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 2740354a-0fa9-483c-9c6f-1fcf0b2d2e10

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

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.

0 participants