Skip to content

Commit

Permalink
[explorer/frontend] fix: clear filter with default value
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegMakarenko committed Jun 21, 2024
1 parent 26c06f6 commit 7431176
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions explorer/frontend/components/Filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const FilterModal = ({ isVisible, title, type, isSearchEnabled, options, onSearc
);
};

const Filter = ({ isSelectedItemsShown, data, value, search, isDisabled, onChange }) => {
const Filter = ({ isSelectedItemsShown, data, value, search, isDisabled, onChange, onClear }) => {
const { t } = useTranslation();
const [expandedFilter, setExpandedFilter] = useState({});
const [selectedItems, setSelectedItems] = useState({});
Expand All @@ -138,7 +138,11 @@ const Filter = ({ isSelectedItemsShown, data, value, search, isDisabled, onChang
const getTextStyle = name => `${styles.text} ${isFilerActive(name) ? styles.textActive : null}`;
const clear = () => {
setExpandedFilter(null);
onChange({});
if (onClear) {
onClear();
} else {
onChange({});
}
};
const handleFilterPress = filter => {
if (!isFilterAvailable(filter.name)) {
Expand Down
1 change: 1 addition & 0 deletions explorer/frontend/pages/accounts/[address].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ const AccountInfo = ({ accountInfo, preloadedTransactions }) => {
isDisabled={transactionPagination.isLoading}
value={transactionPagination.filter}
onChange={transactionPagination.changeFilter}
onClear={transactionPagination.clearFilter}
search={search}
/>
<ButtonCSV data={transactionPagination.data} fileName={`transactions-${address}`} format={formatTransactionCSV} />
Expand Down

0 comments on commit 7431176

Please sign in to comment.