Skip to content

React migration: Search form - #331

Merged
paigewilliams merged 2 commits into
paige-react-fe-testingfrom
search-form
Nov 11, 2026
Merged

paigewilliams merged 2 commits into
paige-react-fe-testingfrom
search-form

Conversation

@paigewilliams

Copy link
Copy Markdown
Collaborator

asana task

Changes

  • Hooks up the form to the /api/search/ endpoint
  • Adds context for search related state
  • routes to the search/ page after submitting the form on the explore/ page
  • Adds a checkbox component

Next up: display the search results on the search page

Copilot AI 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.

🟡 Changes recommended

The explore form can submit a retained query despite appearing blank, and older search responses can overwrite results from newer searches.

2 open issues
What changed in this PR

This PR advances the React search migration by connecting the Explore and Search forms to /api/search/ through shared state. Rendering search results remains a follow-up.

Changes:

  • Adds shared search state, API submission, and navigation to the Search page.
  • Reuses a checkbox component and category list across both forms.
  • Updates login context syntax and removes debug logging.
File Description
client/​app/​utils/​constants.ts Defines shared search categories.
client/​app/​routes/​search.tsx Connects search controls to shared state and submission.
client/​app/​routes/​explore.tsx Connects the Explore form to the search flow.
client/​app/​root.tsx Provides search context across routes.
client/​app/​layouts/​private-route.tsx Removes authentication debug logging.
client/​app/​context/​searchContext.tsx Manages search state, requests, and navigation.
client/​app/​context/​loginContext.tsx Updates context syntax and login action reference.
client/​app/​context/​action.ts Adds search API requests and renames the login action.
client/​app/​components/​header.tsx Reformats username markup without changing behavior.
client/​app/​components/​checkbox.tsx Adds a reusable controlled checkbox.

Review effort: Balanced

Comment on lines +44 to +48
const handleSearch = useCallback(async () => {
try {
const response = await submitSearchAction({ categories, query });
const { results } = response;
setResults(results);
name="query"
placeholder="Search"
aria-describedby="search-icon-label"
onChange={(e) => handleQueryChange(e.target.value)}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is the intended functionality!

@paigewilliams
paigewilliams merged commit 472dad7 into paige-react-fe-testing Nov 11, 2026
2 checks passed
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.

2 participants