Skip to content
Snippets Groups Projects

Move parsedSearchQuery data to query state store

Merged Administrator requested to merge fkling/migrate-parsedsearchquery into main

Created by: fkling

This PR moves parsedSearchQuery, which is currently created and passed down from Layout.tsx to the query state store. I'm also renaming it to searchQueryFromURL to better express what this value represents (the current name is easy to confuse with parsing the query to a token representation).

This used to be stored in SourcegraphWebApps state, but @valerybugakov removed this already in #29176. However, I still think that threading it through multiple layers of components is not necessary.

It looks like there are only a few number of places where access to the URL search query is needed:

  • GlobalNavbar updates the "internal" query state when the query from the URL changes (this will likely be refactored once search context is also moved to the query store)
  • routes.tsx decides whether to to show the homepage or the result page based on whether a query is set or not (but maybe there is a better way?)
  • DidYouMean should operate on the submitted query, not the current query from the search input

Removed from:

  • SearchPageInput only used this value to decide whether or not to show the onboarding tour, but this is better determined by the parent component (SearchPage)

Merge request reports

Merged by avatar (Jul 5, 2025 6:15pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading