mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 17:17:45 -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 { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
@@ -17,7 +17,8 @@ function Organizations({ i18n }) {
|
||||
'/organizations/add': i18n._(t`Create New Organization`),
|
||||
});
|
||||
|
||||
const setBreadcrumb = organization => {
|
||||
const setBreadcrumb = useCallback(
|
||||
organization => {
|
||||
if (!organization) {
|
||||
return;
|
||||
}
|
||||
@@ -35,7 +36,9 @@ function Organizations({ i18n }) {
|
||||
),
|
||||
};
|
||||
setBreadcrumbConfig(breadcrumb);
|
||||
};
|
||||
},
|
||||
[i18n]
|
||||
);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
|
||||
Reference in New Issue
Block a user