Move parsedSearchQuery data to query state store
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 SourcegraphWebApp
s 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
)