Optimize Object Explorer Data Fetching Using React Query #2252
+102
−62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This Pull Request improves the performance of the Object Explorer page by implementing React Query for fetching and caching resource kinds, namespaces, and filtered resources.
Previously, every filter change or page refresh triggered multiple backend API requests, leading to unnecessary load and slower UI performance.
Implemented useQuery for resourceKinds and namespaces with caching and 5-minute staleTime
Added useQueries to fetch filtered resource data in parallel based on selected kinds and namespaces
Introduced smart query keys to reuse cached data and reduce repeated backend calls
Enabled global refetch support with refetchResourceData
Improved loading, error handling, and filtering management
Reduced redundant backend calls and improved responsiveness
Related Issue
Fixes #2123
Changes Made
Checklist
Please ensure the following before submitting your PR:
Screenshots or Logs (if applicable)
Additional Notes