Don't recreate views when switching tabs.

master
Tom Hacohen 7 years ago
parent 635a41d41f
commit 5b8c000d45

@ -87,32 +87,23 @@ export class JournalView extends React.Component {
<Tab <Tab
label={itemsTitle} label={itemsTitle}
containerElement={<Link to={routeResolver.getRoute('journals._id.items', {journalUid: journal.uid})} />} containerElement={<Link to={routeResolver.getRoute('journals._id.items', {journalUid: journal.uid})} />}
/> >
<h2>{collectionInfo.displayName}</h2>
{itemsView}
</Tab>
<Tab <Tab
label="Journal Entries" label="Journal Entries"
containerElement={<Link to={routeResolver.getRoute('journals._id.entries', {journalUid: journal.uid})} />} containerElement={<Link to={routeResolver.getRoute('journals._id.entries', {journalUid: journal.uid})} />}
/> >
<h2>{collectionInfo.displayName}</h2>
<JournalViewEntries journal={journal} entries={syncEntries} />;
</Tab>
</Tabs> </Tabs>
<Route <Route
path={routeResolver.getRoute('journals._id')} path={routeResolver.getRoute('journals._id')}
exact={true} exact={true}
render={() => <Redirect to={routeResolver.getRoute('journals._id.items', {journalUid: journal.uid})} />} render={() => <Redirect to={routeResolver.getRoute('journals._id.items', {journalUid: journal.uid})} />}
/> />
<h2>{collectionInfo.displayName}</h2>
<Route
path={routeResolver.getRoute('journals._id.entries')}
render={() => {
return <JournalViewEntries journal={journal} entries={syncEntries} />;
}
}
/>
<Route
path={routeResolver.getRoute('journals._id.items')}
render={() => {
return itemsView;
}
}
/>
</div> </div>
); );
} }

Loading…
Cancel
Save