commands.dev icon indicating copy to clipboard operation
commands.dev copied to clipboard

Add URL query parameter support for search

Open mvanhorn opened this issue 8 months ago • 3 comments

Summary

  • Parse ?query= URL parameter on page load and populate the search input, triggering an Algolia search
  • Update the URL query parameter as the user types, enabling shareable/bookmarkable search links (e.g. commands.dev/?query=git)

Why this matters

#60 - Users want to share direct links to search results and query commands.dev from the address bar.

Changes

  • components/search/CustomSearchBox.tsx: Read ?query= param on mount via Next.js router, set search state and call refine(); update URL on input change via history.replaceState
  • components/search/MobileSearchBox.tsx: Same URL query parameter support for mobile search

Test plan

  • [ ] Visit /?query=git and verify the search input is populated with "git" and results are shown
  • [ ] Type a search term and verify the URL updates to include ?query=<term>
  • [ ] Clear the search and verify ?query= is removed from the URL
  • [ ] Navigate to a different page and back - verify search resets correctly

Fixes #60

This contribution was developed with AI assistance (Claude Code).

mvanhorn avatar Mar 20 '26 22:03 mvanhorn

@mvanhorn is attempting to deploy a commit to the warpdotdev Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 20 '26 22:03 vercel[bot]

Code Review

PR: Add URL query parameter support for search by @mvanhorn

  • ✅ Feature implementation

Wallet: 0xdaE5d307339074A24F579dB48e7c639359D94904

Code review

BossChaos avatar May 17 '26 15:05 BossChaos

Code Review

PR: Add URL query parameter support for search by @mvanhorn

  • ✅ Feature

Wallet: 0xdaE5d307339074A24F579dB48e7c639359D94904

Code review

BossChaos avatar May 17 '26 15:05 BossChaos