From 952530f370a0d7c2d74a9c080bbe37e69745782a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 20 Nov 2022 00:05:45 +0300 Subject: Fix useSearchParams() usage --- vnext/src/ui/Feeds.js | 8 ++++---- vnext/src/ui/Post.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vnext/src/ui/Feeds.js b/vnext/src/ui/Feeds.js index bd69155f..129be2de 100644 --- a/vnext/src/ui/Feeds.js +++ b/vnext/src/ui/Feeds.js @@ -45,7 +45,7 @@ function RequireAuth({ children }) { * */ export function Discover() { - const search = useSearchParams(); + const [search] = useSearchParams(); const query = { baseUrl: '/api/messages', search: search, @@ -84,7 +84,7 @@ export function Discussions() { */ export function Blog() { const { user } = useParams(); - const params = useSearchParams(); + const [params] = useSearchParams(); const search = { ...params, uname: user @@ -167,7 +167,7 @@ function Feed({ query }) { tag: '' }); const [loading, setLoading] = useState(true); - const filter = useSearchParams(); + const [filter] = useSearchParams(); useEffect(() => { setLoading(true); let getPageParam = (pageParam, lastMessage, /** @type { URLSearchParams } */ filterParams) => { @@ -202,7 +202,7 @@ function Feed({ query }) { }; }); }); - }, [location.search, query, filter]); + }, [query, filter]); return (state.msgs.length > 0 ? (
{ diff --git a/vnext/src/ui/Post.js b/vnext/src/ui/Post.js index 74b74ffc..8fc753b4 100644 --- a/vnext/src/ui/Post.js +++ b/vnext/src/ui/Post.js @@ -17,7 +17,7 @@ export default function Post() { const [visitor] = useVisitor(); let draftMessage = (location.state || {}).data || {}; let [draft, setDraft] = useState(draftMessage.body); - let params = useSearchParams(); + let [params] = useSearchParams(); let postMessage = (template) => { const { attach, body } = template; const postAction = draftMessage.mid ? update(draftMessage.mid, 0, body) : post(body, attach); -- cgit v1.2.3