Skip to content

Commit

Permalink
fix(website): pagination reset on search page table resort (#3667)
Browse files Browse the repository at this point in the history
Fixes #3665

Update `setOrderByField` and `setOrderDirection` functions to reset pagination to page 1 when sorting.

* Modify `setOrderByField` to set the page state to '1' when changing the order by field.
* Modify `setOrderDirection` to set the page state to '1' when changing the order direction.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/loculus-project/loculus/issues/3665?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
theosanderson authored Feb 11, 2025
1 parent 7b025a4 commit a47d51a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions website/src/components/SearchPage/SearchFullUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ export const InnerSearchFullUI = ({
setState((prev: QueryState) => ({
...prev,
orderBy: field,
page: '1',
}));
};
const setOrderDirection = (direction: string) => {
setState((prev: QueryState) => ({
...prev,
order: direction,
page: '1',
}));
};

Expand Down

0 comments on commit a47d51a

Please sign in to comment.