Skip to content

CONSOLE-5065: Update list of PatternFly packages that support dynamic modules#16182

Open
vojtechszocs wants to merge 1 commit intoopenshift:mainfrom
vojtechszocs:update-dynamic-module-specs
Open

CONSOLE-5065: Update list of PatternFly packages that support dynamic modules#16182
vojtechszocs wants to merge 1 commit intoopenshift:mainfrom
vojtechszocs:update-dynamic-module-specs

Conversation

@vojtechszocs
Copy link
Contributor

@vojtechszocs vojtechszocs commented Mar 20, 2026

Summary by CodeRabbit

  • New Features
    • Expanded default PatternFly package support to include react-charts, react-data-view, and react-templates in the dynamic plugin system.

@openshift-ci openshift-ci bot requested review from cajieh and spadgett March 20, 2026 19:58
@openshift-ci openshift-ci bot added the component/sdk Related to console-plugin-sdk label Mar 20, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2026
@vojtechszocs vojtechszocs changed the title Update list of PatternFly packages that support dynamic modules CONSOLE-5065: Update list of PatternFly packages that support dynamic modules Mar 20, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 20, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 20, 2026

@vojtechszocs: This pull request references CONSOLE-5065 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary by CodeRabbit

  • New Features
  • Expanded default PatternFly package support to include react-charts, react-data-view, and react-templates in the dynamic plugin system.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

The change refactors the default shared dynamic module configuration in the webpack plugin to use a centralized, reusable list of PatternFly packages instead of inline hardcoded values. It expands package coverage from three packages to six by introducing a new dynamicModulePatternFlyPackages constant. The packageSpecs type definition is formalized through a new DynamicModulePackageSpec type alias, improving type safety. Constructor logic is updated to iterate over this list and compute module specifications using consistent defaults (indexModule='dist/esm/index.js', resolutionField='module').

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts (1)

345-350: Avoid object spreads inside reducers in this build-time path.

Line 348 and Line 360 recreate accumulator objects on each iteration. This adds avoidable allocations during compilation. Prefer mutating the local reducer accumulator.

Suggested refactor
     const sharedDynamicModulePackageSpecs =
       this.adaptedOptions.sharedDynamicModuleSettings.packageSpecs ??
       dynamicModulePatternFlyPackages.reduce<Record<string, DynamicModulePackageSpec>>(
-        (acc, moduleName) => ({ ...acc, [moduleName]: {} }),
+        (acc, moduleName) => {
+          acc[moduleName] = {};
+          return acc;
+        },
         {},
       );
 
     this.sharedDynamicModuleMaps = Object.entries(sharedDynamicModulePackageSpecs).reduce<
       Record<string, DynamicModuleMap>
     >((acc, [pkgName, { indexModule = 'dist/esm/index.js', resolutionField = 'module' }]) => {
       const basePath = resolvedModulePaths
         .map((p) => path.resolve(p, pkgName))
         .find((p) => fs.existsSync(p) && fs.statSync(p).isDirectory());
 
-      return basePath
-        ? { ...acc, [pkgName]: getDynamicModuleMap(basePath, indexModule, resolutionField) }
-        : acc;
+      if (basePath) {
+        acc[pkgName] = getDynamicModuleMap(basePath, indexModule, resolutionField);
+      }
+      return acc;
     }, {});

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

Also applies to: 352-362

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts`
around lines 345 - 350, The reducer used to build
sharedDynamicModulePackageSpecs recreates the accumulator on each iteration via
object spread, causing unnecessary allocations; change the reduce callback used
with dynamicModulePatternFlyPackages (the call that builds
sharedDynamicModulePackageSpecs when
adaptedOptions.sharedDynamicModuleSettings.packageSpecs is null) to mutate the
passed-in accumulator instead of returning a new object each time (e.g., assign
acc[moduleName] = {} and return acc), ensuring the accumulator type matches
DynamicModulePackageSpec and updating any similar reduce usage in the same file
(lines around the dynamicModulePatternFlyPackages.reduce) to follow the same
in-place mutation pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts`:
- Around line 345-350: The reducer used to build sharedDynamicModulePackageSpecs
recreates the accumulator on each iteration via object spread, causing
unnecessary allocations; change the reduce callback used with
dynamicModulePatternFlyPackages (the call that builds
sharedDynamicModulePackageSpecs when
adaptedOptions.sharedDynamicModuleSettings.packageSpecs is null) to mutate the
passed-in accumulator instead of returning a new object each time (e.g., assign
acc[moduleName] = {} and return acc), ensuring the accumulator type matches
DynamicModulePackageSpec and updating any similar reduce usage in the same file
(lines around the dynamicModulePatternFlyPackages.reduce) to follow the same
in-place mutation pattern.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 023fabc2-20a4-4f2a-8563-111f21a7efa3

📥 Commits

Reviewing files that changed from the base of the PR and between 2ba508b and 263c98e.

📒 Files selected for processing (1)
  • frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts
🔇 Additional comments (2)
frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts (2)

152-164: Nice centralization of default PatternFly dynamic-module packages.

Moving this into dynamicModulePatternFlyPackages makes defaults easier to audit and extend.


166-173: Type extraction improves options readability.

Using DynamicModulePackageSpec makes packageSpecs clearer and keeps the defaults contract in one place.

Also applies to: 275-278

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 21, 2026

@vojtechszocs: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@logonoff
Copy link
Member

/label px-approved
/label docs-approved

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/sdk Related to console-plugin-sdk docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants