Skip to content

Commit 975782a

Browse files
authored
reset pagination to page 1 on sort and search change (#162) (#163)
1 parent 7450233 commit 975782a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/routes/dashboard/Dashboard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const Dashboard = () => {
6464
setSortBy(column);
6565
setSortOrder("asc");
6666
}
67+
setCurrentPage(1);
6768
};
6869

6970
const {
@@ -111,7 +112,12 @@ const Dashboard = () => {
111112
placeholder={t("common.placeholder.search")}
112113
className="rounded-md border-none dark:bg-transparent px-4 shadow-none py-2"
113114
value={search}
114-
onChange={(e) => setSearch(e.target.value)}
115+
onChange={(e) => {
116+
setSearch(e.target.value);
117+
if (currentPage !== 1) {
118+
setCurrentPage(1);
119+
}
120+
}}
115121
/>
116122
</div>
117123
<Link to="/plan/new">

0 commit comments

Comments
 (0)