mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fixed accounts auto scrolling (#17075)
* Fixed a bug * Fixed additional bug
This commit is contained in:
parent
5419f9414c
commit
426e3c37a4
@ -1,6 +1,7 @@
|
||||
import React, { useLayoutEffect, useRef } from 'react';
|
||||
import React, { memo, useLayoutEffect, useRef } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import { isEqual } from 'lodash';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import CheckBox, { CHECKED, INDETERMINATE, UNCHECKED } from '../check-box';
|
||||
import Identicon from '../identicon';
|
||||
@ -23,7 +24,7 @@ const AccountList = ({
|
||||
const selectedAccountScrollRef = useRef(null);
|
||||
useLayoutEffect(() => {
|
||||
selectedAccountScrollRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
}, []);
|
||||
}, [selectedAccounts]);
|
||||
|
||||
const Header = () => {
|
||||
let checked;
|
||||
@ -178,4 +179,6 @@ AccountList.propTypes = {
|
||||
handleAccountClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default AccountList;
|
||||
export default memo(AccountList, (prevProps, nextProps) => {
|
||||
return isEqual(prevProps.selectedAccounts, nextProps.selectedAccounts);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user