From 0b176a60eb06a1f00233559e2e771084ccd12e4a Mon Sep 17 00:00:00 2001 From: Tiago Date: Sun, 19 May 2024 17:02:37 -0300 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20Corre=C3=A7=C3=A3o=20do=20t=C3=ADtu?= =?UTF-8?q?lo=20com/sem=20filtros=20#247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close: #247 --- .../Home/components/ShelterListView/ShelterListView.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/Home/components/ShelterListView/ShelterListView.tsx b/src/pages/Home/components/ShelterListView/ShelterListView.tsx index ec57fc7b..35e83f69 100644 --- a/src/pages/Home/components/ShelterListView/ShelterListView.tsx +++ b/src/pages/Home/components/ShelterListView/ShelterListView.tsx @@ -36,7 +36,10 @@ const ShelterListView = React.forwardRef( return (

- Abrigos disponíveis ({count}) + {searchParams.toString() + ? `Abrigos encontrados (${count})` + : 'Total de abrigos' + }

Date: Wed, 22 May 2024 08:00:00 -0300 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20Corre=C3=A7=C3=A3o=20do=20t=C3=ADtu?= =?UTF-8?q?lo=20com/sem=20filtros=20#247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close: #247 --- src/pages/Home/components/ShelterListView/ShelterListView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Home/components/ShelterListView/ShelterListView.tsx b/src/pages/Home/components/ShelterListView/ShelterListView.tsx index 35e83f69..98c9eb2f 100644 --- a/src/pages/Home/components/ShelterListView/ShelterListView.tsx +++ b/src/pages/Home/components/ShelterListView/ShelterListView.tsx @@ -38,7 +38,7 @@ const ShelterListView = React.forwardRef(

{searchParams.toString() ? `Abrigos encontrados (${count})` - : 'Total de abrigos' + : `Total de abrigos (${count})` }

Date: Thu, 23 May 2024 16:17:45 -0300 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20Filtros=20n=C3=A3o=20persistem=20ao?= =?UTF-8?q?=20retornar=20de=20um=20abrigo=20espec=C3=ADfico.=20#291?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close: #291 --- src/pages/Home/Home.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx index 4f51f924..c954e52a 100644 --- a/src/pages/Home/Home.tsx +++ b/src/pages/Home/Home.tsx @@ -1,4 +1,4 @@ -import { useCallback, useMemo, useState } from 'react'; +import { useCallback, useEffect, useMemo, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; import { RotateCw } from 'lucide-react'; import qs from 'qs'; @@ -27,6 +27,13 @@ const Home = () => { ...qs.parse(new URLSearchParams(window.location.search).toString()), }); + useEffect(() => { + const storedSearchParams = localStorage.getItem('searchParams'); + if (storedSearchParams) { + setSearchParams(new URLSearchParams(storedSearchParams)); + } + }, []); + const [, setSearch] = useThrottle( { throttle: 400, @@ -47,6 +54,7 @@ const Home = () => { setFilterData(initialFilterData); setSearchParams(''); refresh(); + localStorage.removeItem('searchParams'); }, [refresh, setSearch, setSearchParams]); const hasMore = useMemo( @@ -62,6 +70,7 @@ const Home = () => { skipNulls: true, }); setSearchParams(searchQuery); + localStorage.setItem('searchParams', JSON.stringify(searchQuery)); refresh({ params: { search: searchQuery,