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();
}
componentDidUpdate() {
const scrollRegion = document.querySelector(".preferences-content .scroll-region-content");
scrollRegion.scrollTop = 0;
this._focusContent();
componentDidUpdate(oldProps) {
if (oldProps.tab !== this.props.tab) {
const scrollRegion = document.querySelector(".preferences-content .scroll-region-content");
scrollRegion.scrollTop = 0;
this._focusContent();
}
}
_localHandlers() {

View file

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