Skip to content

Conversation

sniok
Copy link
Contributor

@sniok sniok commented Oct 2, 2025

I've noticed that in the development mode flux page becomes unresponsive and hangs.

This PR refactors how resource classes are created and used. Instead of recreating classes on each rerender it now defines all classes in Resources.tsx

And in all pages it now uses Class.useList and Class.useGet functions instead of old ones

Testing

Click through all flux-registered pages and verify that lists are still displayed as usual

@sniok sniok requested review from ashu8912 and Copilot October 3, 2025 13:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the Flux plugin to define all resource classes as KubeObject extensions in a centralized Resources.tsx file and standardizes the use of useGet and useList methods throughout the codebase.

  • Replaces function-based resource class creation with KubeObject class extensions for better type safety and consistency
  • Consolidates all resource definitions into a single Resources.tsx file for improved maintainability
  • Simplifies component code by using the standardized useGet and useList methods instead of custom state management

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
flux/src/common/Resources.tsx Defines all Flux resource classes extending KubeObject with proper static properties
flux/src/sources/SourceSingle.tsx Refactors to use getSourceClassByPluralName helper function
flux/src/sources/SourceList.tsx Removes function-based class definitions and uses imported resource classes
flux/src/sources/Source.tsx Simplifies useSource hook to use useGet method and removes GetSource component
flux/src/overview/index.tsx Refactors to use direct useList calls with resource classes and helper functions
flux/src/notifications/NotificationSingle.tsx Updates to use imported resource classes and useGet method
flux/src/notifications/NotificationList.tsx Removes function-based definitions and uses imported classes with useList
flux/src/mapView.tsx Updates resource class imports and adds weight properties to nodes
flux/src/kustomizations/KustomizationSingle.tsx Simplifies to use Kustomization class and useGet method
flux/src/kustomizations/KustomizationList.tsx Removes function-based definition and uses imported Kustomization class
flux/src/image-automation/ImageAutomationSingle.tsx Updates to use imported resource classes
flux/src/image-automation/ImageAutomationList.tsx Removes function-based definitions and uses imported classes
flux/src/helpers/index.tsx Adds gridTemplate properties to table columns
flux/src/helm-releases/HelmReleaseSingle.tsx Simplifies to use HelmRelease class and useGet method
flux/src/helm-releases/HelmReleaseList.tsx Removes function-based definition and uses imported HelmRelease class
flux/src/actions/index.tsx Updates SyncWithSourceAction to use useSource hook

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Can you please provide a PR description/steps to test/issue link?

@illume illume added the flux flux plugin related issues label Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flux flux plugin related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants