Skip to content

Commit

Permalink
fix: unchecked asset filters (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
NandyBa authored Dec 18, 2024
1 parent 029f199 commit 77880df
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'

import { Select } from '@mantine/core'

import { assetsViewDefaultFilter } from 'src/states'
import {
OtherRealtoken,
UserRealtoken,
Expand Down Expand Up @@ -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}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'

import { Select } from '@mantine/core'

import { assetsViewDefaultFilter } from 'src/states'
import {
OtherRealtoken,
UserRealtoken,
Expand Down Expand Up @@ -46,7 +47,12 @@ export const AssetsViewRmmStatusFilter: FC<AssetsViewRmmStatusFilterProps> = ({
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}
/>
)
Expand Down
7 changes: 6 additions & 1 deletion src/components/assetsView/filters/AssetsViewSort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -73,7 +74,11 @@ export const AssetsViewSort: FC<AssetsViewSortProps> = ({
data={sortOptions}
value={filter.sortBy}
onChange={(value) =>
onChange({ ...filter, sortBy: value as AssetSortType })
onChange({
...filter,
sortBy:
(value as AssetSortType) ?? assetsViewDefaultFilter.sortBy,
})
}
classNames={inputClasses}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'

import { Select } from '@mantine/core'

import { assetsViewDefaultFilter } from 'src/states'
import {
OtherRealtoken,
UserRealtoken,
Expand Down Expand Up @@ -66,7 +67,12 @@ export const AssetsViewSubsidyFilter: FC<AssetsViewSubsidyFilterProps> = ({
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}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'

import { Select } from '@mantine/core'

import { assetsViewDefaultFilter } from 'src/states'
import {
OtherRealtoken,
UserRealtoken,
Expand Down Expand Up @@ -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}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'

import { Select } from '@mantine/core'

import { assetsViewDefaultFilter } from 'src/states'
import {
OtherRealtoken,
UserRealtoken,
Expand Down Expand Up @@ -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}
/>
Expand Down

0 comments on commit 77880df

Please sign in to comment.