1 parent d9fadf2 commit c8e7084Copy full SHA for c8e7084
1 file changed
app/frontend/pages/items/index.tsx
@@ -17,7 +17,7 @@ export default function ItemsIndex({ items, pagy }: Props) {
17
}
18
19
20
- const goToPage = (page: number) => {
+ const goToPage = (page: number | null = 1) => {
21
router.get(itemsPath(), { page }, { preserveState: true })
22
23
@@ -84,7 +84,7 @@ export default function ItemsIndex({ items, pagy }: Props) {
84
<Button
85
variant="outline"
86
size="sm"
87
- onClick={() => goToPage(pagy.prev!)}
+ onClick={() => goToPage(pagy?.prev)}
88
disabled={!pagy.prev}
89
>
90
Previous
@@ -95,7 +95,7 @@ export default function ItemsIndex({ items, pagy }: Props) {
95
96
97
98
- onClick={() => goToPage(pagy.next!)}
+ onClick={() => goToPage(pagy?.next)}
99
disabled={!pagy.next}
100
101
Next
0 commit comments