Skip to content

Reduce redundant metadata API requests in dashboard pages#250

Open
dolliecoder wants to merge 1 commit into
volcano-sh:mainfrom
dolliecoder:fix/reduce-duplicate-metadata-fetches
Open

Reduce redundant metadata API requests in dashboard pages#250
dolliecoder wants to merge 1 commit into
volcano-sh:mainfrom
dolliecoder:fix/reduce-duplicate-metadata-fetches

Conversation

@dolliecoder

@dolliecoder dolliecoder commented May 16, 2026

Copy link
Copy Markdown

Summary

This PR reduces redundant metadata API requests across the Jobs, Pods, and PodGroups pages.

Previously, metadata fetches such as fetchAllNamespaces() and fetchAllQueues() were coupled with data-fetch effects that depended on dynamic query callbacks (fetchJobs, fetchPods, fetchPodGroups). Since these callbacks are recreated when search, filters, or pagination state changes, the metadata endpoints were being unnecessarily re-requested multiple times.

Changes

  • Separated metadata fetches into dedicated mount-only useEffect hooks

  • Preserved existing dynamic data-fetch behavior for jobs, pods, and podgroups

  • Reduced unnecessary requests to:

    • /api/namespaces
    • /api/all-queues

Files Updated

  • frontend/src/components/jobs/Jobs.jsx
  • frontend/src/components/pods/Pods.jsx
  • frontend/src/components/podgroups/PodGroups.jsx

Result

  • Reduced redundant API requests during search/filter interactions
  • Improved frontend request efficiency
  • Preserved existing UI behavior and application flow

Testing

Verified that:

  • search and filtering continue to work correctly
  • pagination behavior remains unchanged
  • metadata requests are no longer repeatedly triggered on query state updates
  • no UI regressions were introduced

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jessestutler for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

Welcome @dolliecoder! It looks like this is your first PR to volcano-sh/dashboard 🎉

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the data fetching logic in the Jobs, PodGroups, and Pods components by moving metadata fetching (namespaces and queues) into separate useEffect hooks that run only on mount. Feedback was provided to include cleanup mechanisms in these new hooks to prevent potential state updates on unmounted components and to consider the impact of moving these fetches out of the manual refresh cycle.

Comment thread frontend/src/components/jobs/Jobs.jsx
Comment thread frontend/src/components/podgroups/PodGroups.jsx
Comment thread frontend/src/components/pods/Pods.jsx
Signed-off-by: dolliecoder <dollychahar27@gmail.com>
@dolliecoder dolliecoder force-pushed the fix/reduce-duplicate-metadata-fetches branch from 7413e7b to a97f5f5 Compare May 16, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants