Skip to content

Commit 7431176

Browse files
committed
[explorer/frontend] fix: clear filter with default value
1 parent 26c06f6 commit 7431176

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

explorer/frontend/components/Filter.jsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const FilterModal = ({ isVisible, title, type, isSearchEnabled, options, onSearc
118118
);
119119
};
120120

121-
const Filter = ({ isSelectedItemsShown, data, value, search, isDisabled, onChange }) => {
121+
const Filter = ({ isSelectedItemsShown, data, value, search, isDisabled, onChange, onClear }) => {
122122
const { t } = useTranslation();
123123
const [expandedFilter, setExpandedFilter] = useState({});
124124
const [selectedItems, setSelectedItems] = useState({});
@@ -138,7 +138,11 @@ const Filter = ({ isSelectedItemsShown, data, value, search, isDisabled, onChang
138138
const getTextStyle = name => `${styles.text} ${isFilerActive(name) ? styles.textActive : null}`;
139139
const clear = () => {
140140
setExpandedFilter(null);
141-
onChange({});
141+
if (onClear) {
142+
onClear();
143+
} else {
144+
onChange({});
145+
}
142146
};
143147
const handleFilterPress = filter => {
144148
if (!isFilterAvailable(filter.name)) {

explorer/frontend/pages/accounts/[address].jsx

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ const AccountInfo = ({ accountInfo, preloadedTransactions }) => {
269269
isDisabled={transactionPagination.isLoading}
270270
value={transactionPagination.filter}
271271
onChange={transactionPagination.changeFilter}
272+
onClear={transactionPagination.clearFilter}
272273
search={search}
273274
/>
274275
<ButtonCSV data={transactionPagination.data} fileName={`transactions-${address}`} format={formatTransactionCSV} />

0 commit comments

Comments
 (0)