From 2542f1b098b7db1180285b99b8180f36a9340d8e Mon Sep 17 00:00:00 2001 From: Nar Cuenca Date: Wed, 3 Jan 2024 09:20:27 +0800 Subject: [PATCH] fix: sync search keywords --- src/shell/components/GlobalSearch/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/shell/components/GlobalSearch/index.tsx b/src/shell/components/GlobalSearch/index.tsx index 8f36889a7a..72c6d7c43b 100644 --- a/src/shell/components/GlobalSearch/index.tsx +++ b/src/shell/components/GlobalSearch/index.tsx @@ -287,6 +287,14 @@ export const GlobalSearch = () => { setMediaFolderKeyword(apiQueryTerm); }, [apiQueryTerm]); + useEffect(() => { + const paramsSearchKeyword = params?.get("q"); + + if (paramsSearchKeyword) { + setSearchKeyword(paramsSearchKeyword); + } + }, [params]); + //@ts-ignore TODO fix typing for useMetaKey const shortcutHelpText = useMetaKey("k", () => { textfieldRef.current?.querySelector("input").focus();