Skip to content

Commit

Permalink
fix: filtering the books list resets the pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Dec 18, 2023
1 parent 32219a4 commit bb86845
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pwa/components/book/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Filters: FunctionComponent<Props> = ({ filters, mutation }) => (
enableReinitialize={true}
onSubmit={(values, { setSubmitting, setStatus, setErrors }) => {
mutation.mutate(
values,
{ ...values, page: 1 },
{
onSuccess: () => {
setStatus({
Expand Down
2 changes: 1 addition & 1 deletion pwa/components/book/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const List: NextPage<Props> = ({ data, hubURL, filters, page }) => {
value={filters.order?.title ?? ""}
displayEmpty
onChange={(event) => {
filtersMutation.mutate({ ...filters, order: event.target.value ? { title: event.target.value } : undefined });
filtersMutation.mutate({ ...filters, page: 1, order: event.target.value ? { title: event.target.value } : undefined });
}}
>
<MenuItem value="">Relevance</MenuItem>
Expand Down

0 comments on commit bb86845

Please sign in to comment.