Side menu journals: don't trigger recalcs on route changes.

master
Tom Hacohen 7 years ago
parent a77e9077bf
commit e085c0c40a

@ -35,6 +35,7 @@ class SideMenu extends React.PureComponent {
constructor(props: any) { constructor(props: any) {
super(props); super(props);
this.logout = this.logout.bind(this); this.logout = this.logout.bind(this);
this.journalClicked = this.journalClicked.bind(this);
} }
logout() { logout() {
@ -42,6 +43,11 @@ class SideMenu extends React.PureComponent {
this.props.onCloseDrawerRequest(); this.props.onCloseDrawerRequest();
} }
journalClicked(journalUid: string) {
this.props.onCloseDrawerRequest();
this.props.history.push(routeResolver.getRoute('journals._id', { journalUid: journalUid }));
}
render() { render() {
const username = (this.props.etesync && this.props.etesync.credentials.email) ? const username = (this.props.etesync && this.props.etesync.credentials.email) ?
this.props.etesync.credentials.email this.props.etesync.credentials.email
@ -56,10 +62,7 @@ class SideMenu extends React.PureComponent {
<SideMenuJournals <SideMenuJournals
etesync={this.props.etesync} etesync={this.props.etesync}
journals={this.props.journals.value} journals={this.props.journals.value}
onItemClick={(journalUid: string) => { onItemClick={this.journalClicked}
this.props.onCloseDrawerRequest();
this.props.history.push(routeResolver.getRoute('journals._id', { journalUid: journalUid }));
}}
/> />
</React.Fragment> </React.Fragment>
); );

Loading…
Cancel
Save