-
Notifications
You must be signed in to change notification settings - Fork 732
CONSOLE-5065: Align Console useResolvedExtensions hook with upstream plugin SDK #16815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,12 @@ table in [Console dynamic plugins README](./README.md). | |
|
|
||
| ## 4.23.0-prerelease.5 - TBD | ||
|
|
||
| - **Type breaking**: Renamed `ExtensionTypeGuard` type to `ExtensionPredicate` ([#16115], [CONSOLE-5065]) | ||
| > This release removes support for passing multiple predicates to `useResolvedExtensions` hook. | ||
| > Consumers should call this hook once per each distinct extension type to avoid complexity associated | ||
| > with unions of distinct extension objects. | ||
|
|
||
| - **Type breaking**: Replace `ExtensionTypeGuard` with `ExtensionPredicate` from `@openshift/dynamic-plugin-sdk` ([#16115], [CONSOLE-5065]) | ||
| - **Breaking**: `useResolvedExtensions` hook now accepts a single predicate parameter (TODO) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still don't know how I feel about making a runtime breaking change in this release, even if most plugins won't be affected...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at git history, Console Console I'd rather do this change now than wait for the next release, but if others think we must avoid breaking changes (regardless of how big or small they are) then I can keep the glue code for evaluating multiple predicates.
Comment on lines
+15
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Document the complete breaking change before publishing. The public return type also changed from 🤖 Prompt for AI Agents |
||
|
|
||
| ## 4.23.0-prerelease.4 - 2026-07-14 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,12 @@ | ||
| import type { UseResolvedExtensionsOptions as UseResolvedExtensionsOptionsSDK } from '@openshift/dynamic-plugin-sdk'; | ||
| import type { Extension, ExtensionPredicate } from '@openshift/dynamic-plugin-sdk'; | ||
| import { useResolvedExtensions as useResolvedExtensionsSDK } from '@openshift/dynamic-plugin-sdk'; | ||
| import { useExtensions } from '@console/plugin-sdk/src/api/useExtensions'; | ||
| import type { UseResolvedExtensions } from '../extensions/console-types'; | ||
| import type { Extension, ExtensionPredicate, ResolvedExtension } from '../types'; | ||
|
|
||
| const hookOptions: UseResolvedExtensionsOptionsSDK = { | ||
| useExtensionsImpl: useExtensions, | ||
| }; | ||
|
|
||
| export const useResolvedExtensions: UseResolvedExtensions = <E extends Extension>( | ||
| ...predicates: ExtensionPredicate<E>[] | ||
| ): [ResolvedExtension<E>[], boolean, any[]] => { | ||
| const predicate = | ||
| predicates.length === 1 | ||
| ? predicates[0] | ||
| : predicates.length > 1 | ||
| ? (extension: Extension): extension is E => predicates.some((guard) => guard(extension)) | ||
| : undefined; | ||
| return useResolvedExtensionsSDK(predicate, hookOptions); | ||
| predicate: ExtensionPredicate<E>, | ||
| ) => { | ||
| const extensions = useExtensions(predicate); | ||
|
|
||
| return useResolvedExtensionsSDK(extensions); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Pin the upgraded SDK packages exactly.
^9.0.0and^5.3.0permit future resolutions to change the SDK and transitive dependency graph. Use exact versions and ensure the lockfile retains integrity metadata; run the repository’s OSV/SCA check for the resolved graph.As per path instructions, package manifests must pin exact versions, verify hashes where supported, and flag known CVEs.
Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Path instructions