From fdaa5fefca933ef856a413aa497a4ac83e2303d2 Mon Sep 17 00:00:00 2001 From: "Rasamoelina, Haja Onjatiana" <26148770+rhahao@users.noreply.github.com> Date: Wed, 8 Jun 2022 10:09:50 +0300 Subject: [PATCH] fix(students): fix issue where search parameters is incorrectly set --- src/pages/Students.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/Students.js b/src/pages/Students.js index 25202b39..b1cb9074 100644 --- a/src/pages/Students.js +++ b/src/pages/Students.js @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from 'react'; -import { useNavigate, useSearchParams } from 'react-router-dom'; +import { createSearchParams, useNavigate, useSearchParams } from 'react-router-dom'; import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'; import { useTranslation } from 'react-i18next'; import { styled, alpha } from '@mui/material/styles'; @@ -139,12 +139,12 @@ const Students = () => { !isFemale && assTypes.length === 0 ) { - setStudentsQuery([]); - setSearchParams(''); + setStudentsQuery({}); + setSearchParams(createSearchParams('')); } else { const query = { search: txtSearch, isMale, isFemale, type: assTypes }; setStudentsQuery(query); - setSearchParams(query); + setSearchParams(createSearchParams(query)); } setIsSearch(true);