mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Merge pull request #8939 from mabashian/8937-org-tabs-requests
Wrap breadcrumb function in useCallback to prevent infinite requests on org tabs Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, Fragment } from 'react';
|
import React, { useCallback, useState, Fragment } from 'react';
|
||||||
import { Route, withRouter, Switch, useRouteMatch } from 'react-router-dom';
|
import { Route, withRouter, Switch, useRouteMatch } from 'react-router-dom';
|
||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
@@ -17,25 +17,28 @@ function Organizations({ i18n }) {
|
|||||||
'/organizations/add': i18n._(t`Create New Organization`),
|
'/organizations/add': i18n._(t`Create New Organization`),
|
||||||
});
|
});
|
||||||
|
|
||||||
const setBreadcrumb = organization => {
|
const setBreadcrumb = useCallback(
|
||||||
if (!organization) {
|
organization => {
|
||||||
return;
|
if (!organization) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const breadcrumb = {
|
const breadcrumb = {
|
||||||
'/organizations': i18n._(t`Organizations`),
|
'/organizations': i18n._(t`Organizations`),
|
||||||
'/organizations/add': i18n._(t`Create New Organization`),
|
'/organizations/add': i18n._(t`Create New Organization`),
|
||||||
[`/organizations/${organization.id}`]: `${organization.name}`,
|
[`/organizations/${organization.id}`]: `${organization.name}`,
|
||||||
[`/organizations/${organization.id}/edit`]: i18n._(t`Edit Details`),
|
[`/organizations/${organization.id}/edit`]: i18n._(t`Edit Details`),
|
||||||
[`/organizations/${organization.id}/details`]: i18n._(t`Details`),
|
[`/organizations/${organization.id}/details`]: i18n._(t`Details`),
|
||||||
[`/organizations/${organization.id}/access`]: i18n._(t`Access`),
|
[`/organizations/${organization.id}/access`]: i18n._(t`Access`),
|
||||||
[`/organizations/${organization.id}/teams`]: i18n._(t`Teams`),
|
[`/organizations/${organization.id}/teams`]: i18n._(t`Teams`),
|
||||||
[`/organizations/${organization.id}/notifications`]: i18n._(
|
[`/organizations/${organization.id}/notifications`]: i18n._(
|
||||||
t`Notifications`
|
t`Notifications`
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
setBreadcrumbConfig(breadcrumb);
|
setBreadcrumbConfig(breadcrumb);
|
||||||
};
|
},
|
||||||
|
[i18n]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
|||||||
Reference in New Issue
Block a user