diff options
author | Vitaly Takmazov | 2022-11-20 00:05:45 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:59 +0300 |
commit | 952530f370a0d7c2d74a9c080bbe37e69745782a (patch) | |
tree | b1be1c22eaa2a09ee86eeb854f76a54ea04e3e28 /vnext/src | |
parent | ec0551528d09ab35345aba254d5ce9cd8f04f1ab (diff) |
Fix useSearchParams() usage
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/ui/Feeds.js | 8 | ||||
-rw-r--r-- | 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 ? ( <div className="msgs"> { 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); |