From 2b9e63928142e5972eca39f8c0bff0b7df21a6e6 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Wed, 11 May 2022 00:19:13 -0400 Subject: [PATCH] Default to 'all' search filter for markets on user page --- web/components/contract-search.tsx | 5 ++++- web/components/contract/contracts-list.tsx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/web/components/contract-search.tsx b/web/components/contract-search.tsx index be6afcfd..c4308fc0 100644 --- a/web/components/contract-search.tsx +++ b/web/components/contract-search.tsx @@ -43,6 +43,7 @@ type filter = 'open' | 'closed' | 'resolved' | 'all' export function ContractSearch(props: { querySortOptions?: { defaultSort: Sort + defaultFilter?: filter filter?: { creatorId?: string tag?: string @@ -60,7 +61,9 @@ export function ContractSearch(props: { ? initialSort : querySortOptions?.defaultSort - const [filter, setFilter] = useState('open') + const [filter, setFilter] = useState( + querySortOptions?.defaultFilter ?? 'open' + ) if (!sort) return <> return ( diff --git a/web/components/contract/contracts-list.tsx b/web/components/contract/contracts-list.tsx index 705de807..49431744 100644 --- a/web/components/contract/contracts-list.tsx +++ b/web/components/contract/contracts-list.tsx @@ -59,6 +59,7 @@ export function CreatorContractsList(props: { creator: User }) { creatorId: creator.id, }, defaultSort: 'newest', + defaultFilter: 'all', shouldLoadFromStorage: false, }} />