add keys to custom features list
Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
@@ -41,6 +41,10 @@ describe('Features', () => {
|
||||
createRc: { omit: true },
|
||||
promoteRc: { omit: true },
|
||||
patch: { omit: true },
|
||||
custom: {
|
||||
// shouldn't trigger "missing key" warning in console
|
||||
factory: () => [<div>Custom 1</div>, <div>Custom 2</div>],
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
@@ -29,6 +29,7 @@ import { useProjectContext } from '../contexts/ProjectContext';
|
||||
import { useVersioningStrategyMatchesRepoTags } from '../hooks/useVersioningStrategyMatchesRepoTags';
|
||||
import { validateTagName } from '../helpers/tagParts/validateTagName';
|
||||
|
||||
import { Box } from '@material-ui/core';
|
||||
import { ErrorBoundary, Progress } from '@backstage/core-components';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
|
||||
@@ -89,6 +90,19 @@ export function Features({
|
||||
);
|
||||
}
|
||||
|
||||
let CustomFeatures =
|
||||
features?.custom?.factory({
|
||||
latestRelease: gitBatchInfo.value.latestRelease,
|
||||
project,
|
||||
releaseBranch: gitBatchInfo.value.releaseBranch,
|
||||
repository: gitBatchInfo.value.repository,
|
||||
}) ?? null;
|
||||
if (Array.isArray(CustomFeatures)) {
|
||||
CustomFeatures = CustomFeatures.map((CustomFeature, index) => (
|
||||
<Box key={`grm--custom-feature--${index}`}>{CustomFeature}</Box>
|
||||
));
|
||||
}
|
||||
|
||||
return (
|
||||
<RefetchContext.Provider value={{ fetchGitBatchInfo }}>
|
||||
<ErrorBoundary>
|
||||
@@ -143,13 +157,7 @@ export function Features({
|
||||
/>
|
||||
)}
|
||||
|
||||
{features?.custom?.factory &&
|
||||
features.custom.factory({
|
||||
latestRelease: gitBatchInfo.value.latestRelease,
|
||||
project,
|
||||
releaseBranch: gitBatchInfo.value.releaseBranch,
|
||||
repository: gitBatchInfo.value.repository,
|
||||
})}
|
||||
{CustomFeatures}
|
||||
</ErrorBoundary>
|
||||
</RefetchContext.Provider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user