From 84028190f0d0659e4022f25bb3ac28e8878f8781 Mon Sep 17 00:00:00 2001 From: Leo Singer Date: Mon, 26 Jun 2023 08:55:00 -0400 Subject: [PATCH] Don't add page to search params when on default page (page 1) This results in shorter and nicer URLs. --- app/routes/circulars/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routes/circulars/index.tsx b/app/routes/circulars/index.tsx index 84fcdc8eb..9104771fa 100644 --- a/app/routes/circulars/index.tsx +++ b/app/routes/circulars/index.tsx @@ -68,9 +68,9 @@ function getPageLink( startDate?: string, endDate?: string ) { - const searchParams = new URLSearchParams({ page: page.toString() || '1' }) + const searchParams = new URLSearchParams() + if (page > 1) searchParams.set('page', page.toString()) if (query) searchParams.set('query', query) - searchParams.set('page', page.toString() || '1') if (startDate) searchParams.set('startDate', startDate) if (endDate) searchParams.set('endDate', endDate) return `?${searchParams.toString()}`