diff --git a/src/pages/Account/Settings/Info.js b/src/pages/Account/Settings/Info.js index 799b7b877023f3d0823d0ca78e9f0d0afacaf442..2415de3887dd4839217d24d2a434d13f1df7f910 100644 --- a/src/pages/Account/Settings/Info.js +++ b/src/pages/Account/Settings/Info.js @@ -78,19 +78,23 @@ class Info extends Component { if (!this.main) { return; } - requestAnimationFrame(() => { - let mode = 'inline'; - const { offsetWidth } = this.main; - if (offsetWidth < 641 && offsetWidth > 400) { - mode = 'horizontal'; - } - if (window.innerWidth < 768 && offsetWidth > 400) { - mode = 'horizontal'; - } - this.setState({ - mode, - }); - }); + + const { mode: currentMode } = this.state; + + let mode = 'inline'; + const { offsetWidth } = this.main; + + if (offsetWidth > 400 && offsetWidth < 641) { + mode = 'horizontal'; + } + + if (window.innerWidth < 768 && offsetWidth > 400) { + mode = 'horizontal'; + } + + if (mode !== currentMode) { + requestAnimationFrame(() => this.setState({ mode })); + } }; render() {