From 17c426cc919f81f534ce56d8588b4b850ac9b146 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Sun, 28 Aug 2022 12:40:56 -0500 Subject: [PATCH] update WithRoute to handle query params correctly --- client/homebrew/homebrew.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 7ccbe7de0..f5c80e278 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -14,13 +14,17 @@ const PrintPage = require('./pages/printPage/printPage.jsx'); const WithRoute = (props)=>{ const params = useParams(); - const searchParams = useSearchParams(); + const [searchParams] = useSearchParams(); + const queryParams = {}; + for (const [key, value] of searchParams?.entries() || []) { + queryParams[key] = value; + } const Element = props.el; const allProps = { ...props, ...params, - ...searchParams, - el : undefined + query : queryParams, + el : undefined }; return ; };