Merge pull request #10869 from AlexSCorey/10822-fixReactWarnings

Fixes several react warnings
This commit is contained in:
Kersom
2021-08-12 12:44:09 -04:00
committed by GitHub
5 changed files with 13 additions and 5 deletions

View File

@@ -89,6 +89,11 @@ function Lookup(props) {
}, [state.selectedItems, multiple]); }, [state.selectedItems, multiple]);
const clearQSParams = () => { const clearQSParams = () => {
if (!history.location.search) {
// This prevents "Warning: Hash history cannot PUSH the same path;
// a new entry will not be added to the history stack" from appearing in the console.
return;
}
const parts = history.location.search.replace(/^\?/, '').split('&'); const parts = history.location.search.replace(/^\?/, '').split('&');
const ns = qsConfig.namespace; const ns = qsConfig.namespace;
const otherParts = parts.filter((param) => !param.startsWith(`${ns}.`)); const otherParts = parts.filter((param) => !param.startsWith(`${ns}.`));

View File

@@ -256,8 +256,8 @@ function ActivityStream() {
renderToolbar={(props) => ( renderToolbar={(props) => (
<DatalistToolbar {...props} qsConfig={QS_CONFIG} /> <DatalistToolbar {...props} qsConfig={QS_CONFIG} />
)} )}
renderRow={(streamItem) => ( renderRow={(streamItem, index) => (
<ActivityStreamListItem streamItem={streamItem} /> <ActivityStreamListItem key={index} streamItem={streamItem} />
)} )}
/> />
</Card> </Card>

View File

@@ -66,7 +66,7 @@ function InstanceGroup({ setBreadcrumb }) {
name: ( name: (
<> <>
<CaretLeftIcon /> <CaretLeftIcon />
{t`Back to instance groups`} {t`Back to Instance Groups`}
</> </>
), ),
link: '/instance_groups', link: '/instance_groups',

View File

@@ -32,7 +32,7 @@ describe('<InstanceGroup/>', () => {
test('should render expected tabs', async () => { test('should render expected tabs', async () => {
const expectedTabs = [ const expectedTabs = [
'Back to instance groups', 'Back to Instance Groups',
'Details', 'Details',
'Instances', 'Instances',
'Jobs', 'Jobs',

View File

@@ -135,7 +135,10 @@ function OrganizationDetail({ organization }) {
value={ value={
<ChipGroup numChips={5} totalChips={galaxy_credentials.length}> <ChipGroup numChips={5} totalChips={galaxy_credentials.length}>
{galaxy_credentials.map((credential) => ( {galaxy_credentials.map((credential) => (
<Link to={`/credentials/${credential.id}/details`}> <Link
key={credential.id}
to={`/credentials/${credential.id}/details`}
>
<CredentialChip <CredentialChip
credential={credential} credential={credential}
key={credential.id} key={credential.id}