Simplify state management of viewing page

Explicitly set the page being viewed to "discover" instead of just
rendering the discover page if none is set.

Eliminates several real or possible bugs and edge cases.
This commit is contained in:
Alex Liebowitz 2017-04-30 23:33:53 -04:00 committed by Jeremy Kauffman
parent a82ee8a2d5
commit 0b8d9e3d82

View file

@ -81,6 +81,7 @@ var App = React.createClass({
drawerOpenRaw = sessionStorage.getItem('drawerOpen');
return Object.assign(this.getViewingPageAndArgs(window.location.search), {
viewingPage: 'discover',
drawerOpen: drawerOpenRaw !== null ? JSON.parse(drawerOpenRaw) : true,
errorInfo: null,
modal: null,
@ -249,7 +250,6 @@ var App = React.createClass({
case 'developer':
return ["Developer", "icon-file", <DeveloperPage />];
case 'discover':
default:
return ["Home", "icon-home", <DiscoverPage showWelcome={this.state.justRegistered} {... this.state.pageArgs !== null ? {query: this.state.pageArgs} : {} } />];
}
},