From e085c0c40a7bd06a5ba8de42042c498fbec4fbd3 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sat, 16 Dec 2017 20:10:03 +0000 Subject: [PATCH] Side menu journals: don't trigger recalcs on route changes. --- src/SideMenu/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SideMenu/index.tsx b/src/SideMenu/index.tsx index 61fb3f4..442aef2 100644 --- a/src/SideMenu/index.tsx +++ b/src/SideMenu/index.tsx @@ -35,6 +35,7 @@ class SideMenu extends React.PureComponent { constructor(props: any) { super(props); this.logout = this.logout.bind(this); + this.journalClicked = this.journalClicked.bind(this); } logout() { @@ -42,6 +43,11 @@ class SideMenu extends React.PureComponent { this.props.onCloseDrawerRequest(); } + journalClicked(journalUid: string) { + this.props.onCloseDrawerRequest(); + this.props.history.push(routeResolver.getRoute('journals._id', { journalUid: journalUid })); + } + render() { const username = (this.props.etesync && this.props.etesync.credentials.email) ? this.props.etesync.credentials.email @@ -56,10 +62,7 @@ class SideMenu extends React.PureComponent { { - this.props.onCloseDrawerRequest(); - this.props.history.push(routeResolver.getRoute('journals._id', { journalUid: journalUid })); - }} + onItemClick={this.journalClicked} /> );