fix(prefs): Only scroll to top when switching tabs

This commit is contained in:
Ben Gotow 2016-11-04 11:26:29 -07:00
parent 596777a427
commit d214a52192
2 changed files with 9 additions and 5 deletions

View file

@ -28,10 +28,12 @@ class PreferencesRoot extends React.Component {
this._focusContent(); this._focusContent();
} }
componentDidUpdate() { componentDidUpdate(oldProps) {
const scrollRegion = document.querySelector(".preferences-content .scroll-region-content"); if (oldProps.tab !== this.props.tab) {
scrollRegion.scrollTop = 0; const scrollRegion = document.querySelector(".preferences-content .scroll-region-content");
this._focusContent(); scrollRegion.scrollTop = 0;
this._focusContent();
}
} }
_localHandlers() { _localHandlers() {

View file

@ -19,7 +19,9 @@ class PreferencesAccounts extends React.Component {
} }
componentWillUnmount() { componentWillUnmount() {
this.unsubscribe(); if (this.unsubscribe) {
this.unsubscribe();
}
} }
getStateFromStores({selected} = {}) { getStateFromStores({selected} = {}) {