diff --git a/src/components/Search.js b/src/components/Search.js index 0c7ea65b6..12eab5cc6 100644 --- a/src/components/Search.js +++ b/src/components/Search.js @@ -48,6 +48,16 @@ export function SearchProvider({ children }) { onClose, }) + useEffect(() => { + // trigger search on first load if the URL contains ?q=... + const q = new URLSearchParams(window.location.search).get('q') + if (!q) { + return + } + setIsOpen(true) + setInitialQuery(q) + }, []) + useEffect(() => { // Prepend "Components" to Tailwind UI results that are shown in the "recent" view if (!isOpen) {