Skip to content

Commit

Permalink
fix: render whole account list when fewer than 10 accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 23, 2021
1 parent cd7a86d commit abe1597
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/app/features/account-switch-drawer/components/account-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@ import { Virtuoso } from 'react-virtuoso';
import { AccountWithAddress } from '@app/store/accounts/account.models';
import { AccountListItem } from './account-list-item';

const smallNumberOfAccountsToRenderWholeList = 10;

interface AccountListProps {
handleClose: () => void;
accounts: AccountWithAddress[];
currentAccountIndex: number;
}
export const AccountList = memo(
({ accounts, currentAccountIndex, handleClose }: AccountListProps) => {
if (accounts.length <= smallNumberOfAccountsToRenderWholeList) {
return (
<>
{accounts.map(account => (
<AccountListItem handleClose={handleClose} account={account} key={account.address} />
))}
</>
);
}

return (
<Virtuoso
initialTopMostItemIndex={currentAccountIndex}
Expand Down
3 changes: 2 additions & 1 deletion src/app/pages/set-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export const SetPasswordPage = ({ placeholder }: SetPasswordProps) => {
void analytics.track('submit_invalid_password');
}
return result.meetsAllStrengthRequirements;
}, HUMAN_REACTION_DEBOUNCE_TIME),
// Cocersion to fix type error introduced in latest `ts-debounce`
}, HUMAN_REACTION_DEBOUNCE_TIME) as unknown as yup.TestFunction<any, any>,
}),
});

Expand Down

0 comments on commit abe1597

Please sign in to comment.