Only reload details whe navigating to details from another tab

This commit is contained in:
Alex Corey 2019-07-09 13:38:52 -04:00
parent 3b17170533
commit 7039f82d15

View File

@ -43,13 +43,10 @@ class Organization extends Component {
async componentDidUpdate(prevProps) {
const { location, match } = this.props;
const url = `/organizations/${match.params.id}/`;
const tabs = ['details', 'access', 'teams', 'notifications', 'edit'].map(
tab => `${url}${tab}`
);
const didNavigateFromTab = tabs.includes(prevProps.location.pathname);
if (
prevProps.location.pathname.startsWith(url) &&
prevProps.location !== location &&
didNavigateFromTab &&
location.pathname === `${url}details`
) {
await this.loadOrganization();