Merge pull request #6994 from backstage/erikengervall/add-keys-to-custom-feature-list
[GRM plugin] Add keys to custom features list
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-git-release-manager': patch
|
||||
---
|
||||
|
||||
Wrap each feature in custom feature arrays with an element containing a 'key' to avoid missing-key-warnings
|
||||
@@ -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>],
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
@@ -89,6 +89,21 @@ 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) => (
|
||||
<React.Fragment key={`grm--custom-feature--${index}`}>
|
||||
{CustomFeature}
|
||||
</React.Fragment>
|
||||
));
|
||||
}
|
||||
|
||||
return (
|
||||
<RefetchContext.Provider value={{ fetchGitBatchInfo }}>
|
||||
<ErrorBoundary>
|
||||
@@ -143,13 +158,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