Wire the hero search to a /search results page - #7
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
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
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
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.
Problem
components/home/hero.tsxrendered a bareSearchInput: no form, no submit handler, no target. There was no/searchroute, and nothing linked to one.app/api/searchandlib/searchis complete but was unreachable from the UI. The results page was deferred inprompts/intelligent-search.md; this PR finishes that wiring.Changes
SearchForm— a native<form action="/search" method="get">aroundSearchInput(name="q") — so the box works without client JavaScript. The hero now uses it./searchpage readsqand hands off to aSearchResultsclient component that posts to/api/searchand renders the ranked video and lesson cards, reusing the existingLessonVideoCard/LessonCard.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.tscapturing local dev exceptions into the shared project. Draft #6 already changes that file tocapture_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
npm run lint— passes.npm run typecheck— passes.npm run build— compiles and generates route types; page-data collection needs realSANITY_API_READ_TOKEN(unrelated to this change, same limit noted in Filter ClerkJS network-noise exceptions before PostHog capture #6)./searchreturns 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
SearchResponsecontract but were not exercised against a live search.Created with PostHog Desktop from this inbox report.