Skip to content

Commit

Permalink
fix(suite): search closing on account change
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklim committed Jul 1, 2024
1 parent fdff6c2 commit 40eb425
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dispatch, SetStateAction, useState } from 'react';
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import styled, { css } from 'styled-components';

import { TranslationKey } from '@suite-common/intl-types';
Expand Down Expand Up @@ -127,6 +127,11 @@ export const TokensLayoutNavigation = ({
dispatch(openModal({ type: 'add-token' }));
};

useEffect(() => {
setSearchQuery('');
setExpanded(false);
}, [account.symbol, account.index, account.accountType, setSearchQuery]);

return (
<Wrapper>
<List>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from 'styled-components';

import { SearchAction } from 'src/components/wallet/SearchAction';
import { ExportAction } from './ExportAction';
import { ChangeEvent, Dispatch, SetStateAction, useCallback, useState } from 'react';
import { ChangeEvent, Dispatch, SetStateAction, useCallback, useEffect, useState } from 'react';
import { useDispatch, useTranslation } from 'src/hooks/suite';
import { notificationsActions } from '@suite-common/toast-notifications';
import { fetchAllTransactionsForAccountThunk } from '@suite-common/wallet-core';
Expand Down Expand Up @@ -65,6 +65,12 @@ export const TransactionListActions = ({
[account, dispatch, hasFetchedAll, setSearch, setSelectedPage, translationString],
);

useEffect(() => {
setHasFetchedAll(false);
setExpanded(false);
setSearch('');
}, [account.symbol, account.index, account.accountType, setSearch]);

return (
<Wrapper>
<SearchAction
Expand Down

0 comments on commit 40eb425

Please sign in to comment.