From 77880dfc3cf8c1226cb8ef2d7539390d9e04cab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nandy=20B=C3=A2?= Date: Wed, 18 Dec 2024 19:08:46 +0100 Subject: [PATCH] fix: unchecked asset filters (#95) --- .../assetsView/filters/AssetsViewRentStatusFilter.tsx | 7 ++++++- .../assetsView/filters/AssetsViewRmmStatusFilter.tsx | 8 +++++++- src/components/assetsView/filters/AssetsViewSort.tsx | 7 ++++++- .../assetsView/filters/AssetsViewSubsidyFilter.tsx | 8 +++++++- .../assetsView/filters/AssetsViewUserProtocolFilter.tsx | 7 ++++++- .../assetsView/filters/AssetsViewUserStatusFilter.tsx | 7 ++++++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx b/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx index fe905d9b..d40b18db 100644 --- a/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -50,7 +51,11 @@ export const AssetsViewRentStatusFilter: FC< data={viewOptions} value={filter.rentStatus} onChange={(value) => - onChange({ rentStatus: value as AssetRentStatusType }) + onChange({ + rentStatus: + (value as AssetRentStatusType) ?? + assetsViewDefaultFilter.rentStatus, + }) } classNames={inputClasses} /> diff --git a/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx b/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx index aa68f88f..adc05b69 100644 --- a/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -46,7 +47,12 @@ export const AssetsViewRmmStatusFilter: FC = ({ label={t('label')} data={viewOptions} value={filter.rmmStatus} - onChange={(value) => onChange({ rmmStatus: value as AssetRmmStatusType })} + onChange={(value) => + onChange({ + rmmStatus: + (value as AssetRmmStatusType) ?? assetsViewDefaultFilter.rmmStatus, + }) + } classNames={inputClasses} /> ) diff --git a/src/components/assetsView/filters/AssetsViewSort.tsx b/src/components/assetsView/filters/AssetsViewSort.tsx index b4fa4506..c4e4e762 100644 --- a/src/components/assetsView/filters/AssetsViewSort.tsx +++ b/src/components/assetsView/filters/AssetsViewSort.tsx @@ -4,6 +4,7 @@ import { useSelector } from 'react-redux' import { Grid, Select, Switch } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { selectTransfersIsLoaded } from 'src/store/features/transfers/transfersSelector' import { OtherRealtoken, @@ -73,7 +74,11 @@ export const AssetsViewSort: FC = ({ data={sortOptions} value={filter.sortBy} onChange={(value) => - onChange({ ...filter, sortBy: value as AssetSortType }) + onChange({ + ...filter, + sortBy: + (value as AssetSortType) ?? assetsViewDefaultFilter.sortBy, + }) } classNames={inputClasses} /> diff --git a/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx b/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx index 92aed5e6..1d2270cf 100644 --- a/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -66,7 +67,12 @@ export const AssetsViewSubsidyFilter: FC = ({ label={t('label')} data={viewOptions} value={filter.subsidy} - onChange={(value) => onChange({ subsidy: value as AssetSubsidyType })} + onChange={(value) => + onChange({ + subsidy: + (value as AssetSubsidyType) ?? assetsViewDefaultFilter.subsidy, + }) + } classNames={inputClasses} /> ) diff --git a/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx b/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx index 533880e5..8c56e6d8 100644 --- a/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -54,7 +55,11 @@ export const AssetsViewUserProtocolFilter: FC< data={viewOptions} value={filter.userProtocol} onChange={(value) => - onChange({ userProtocol: value as AssetUserProtocolType }) + onChange({ + userProtocol: + (value as AssetUserProtocolType) ?? + assetsViewDefaultFilter.userProtocol, + }) } classNames={inputClasses} /> diff --git a/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx b/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx index fd30fcf1..c85e7ae1 100644 --- a/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -58,7 +59,11 @@ export const AssetsViewUserStatusFilter: FC< data={viewOptions} value={filter.userStatus} onChange={(value) => - onChange({ userStatus: value as AssetUserStatusType }) + onChange({ + userStatus: + (value as AssetUserStatusType) ?? + assetsViewDefaultFilter.userStatus, + }) } classNames={inputClasses} />