From a96af9e5fc9b513e928f9317e70128d1beb3096b Mon Sep 17 00:00:00 2001 From: ryanml Date: Thu, 22 Jul 2021 11:42:44 -0700 Subject: [PATCH] No longer deconstructing account menu ref if it isn't rendered (#11585) --- ui/components/app/account-menu/account-menu.component.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/components/app/account-menu/account-menu.component.js b/ui/components/app/account-menu/account-menu.component.js index f6c5b75df..aec8decfb 100644 --- a/ui/components/app/account-menu/account-menu.component.js +++ b/ui/components/app/account-menu/account-menu.component.js @@ -253,12 +253,13 @@ export default class AccountMenu extends Component { } setShouldShowScrollButton = () => { + if (!this.accountsRef) { + return; + } + const { scrollTop, offsetHeight, scrollHeight } = this.accountsRef; - const canScroll = scrollHeight > offsetHeight; - const atAccountListBottom = scrollTop + offsetHeight >= scrollHeight; - const shouldShowScrollButton = canScroll && !atAccountListBottom; this.setState({ shouldShowScrollButton });