From ef4142caf9f136e1180f9688e32b05bd8e0739a7 Mon Sep 17 00:00:00 2001 From: Fox Date: Wed, 24 Jun 2026 14:34:33 +0100 Subject: [PATCH] reset page to 1 when changing filters --- frontend/src/components/sidebar.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/sidebar.tsx b/frontend/src/components/sidebar.tsx index 5d5b6ce..a651fd0 100644 --- a/frontend/src/components/sidebar.tsx +++ b/frontend/src/components/sidebar.tsx @@ -39,7 +39,7 @@ export default function Sidebar(props : SidebarProps) { variant='standard' sx={{width: '100%'}} value={props.filters.namePart} - onChange={e => props.onChange(Object.assign({}, {...props.filters}, {namePart: (e.target as any).value}))} + onChange={e => props.onChange(Object.assign({}, {...props.filters}, {namePart: (e.target as any).value, currentPage: 1}))} /> @@ -47,7 +47,7 @@ export default function Sidebar(props : SidebarProps) { Search by Firm Name Only props.onChange(Object.assign({}, {...props.filters}, {nameOnly: value}))} + onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {nameOnly: value, currentPage: 1}))} /> @@ -60,7 +60,7 @@ export default function Sidebar(props : SidebarProps) { options={cities} value={props.filters.cities} getOptionLabel={capitaliseFirstLetter} - onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {cities: value}))} + onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {cities: value, currentPage: 1}))} renderInput={(params) => ( props.onChange(Object.assign({}, {...props.filters}, {minRating: value}))} + onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {minRating: value, currentPage: 1}))} /> @@ -89,7 +89,7 @@ export default function Sidebar(props : SidebarProps) { props.onChange(Object.assign({}, {...props.filters}, {sortBy: (e.target as any).value}))} + onChange={(e : SelectChangeEvent) => props.onChange(Object.assign({}, {...props.filters}, {sortBy: (e.target as any).value, currentPage: 1}))} > {sortingOptions.map(option => { return (