InfoTab: Fix slow loading time#293
Merged
Merged
Conversation
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical performance issue in the Info tab that caused infinite loading and excessive network requests. The root cause was the translation function t being included in useEffect dependency arrays, causing re-execution on every render. Additionally, the code was making an expensive az aks list Azure CLI call to fetch the resource group, even though this information was already available in the namespace labels.
Changes:
- Removed
tfrom the useEffect dependency array to fix the infinite loop - Eliminated the
getClusterResourceIdAndGroupcall and its associated state by readingresourceGroupdirectly from theaks-desktop/project-resource-groupnamespace label - Consolidated two useEffect hooks into one, simplifying the component logic
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The Info tab was loading indefinitely and taking too long when it did load. There are two root causes:
t(translation function) was inuseEffectdependency arrays - sincetis recreated on every render, this caused an infinite loopgetClusterResourceIdAndGroup(az aks list) was called to look up the resource group, even though it was already available in the namespace labelaks-desktop/project-resource-group- the same wayScalingTabandMetricsTabget itTo address this, we read
resourceGroupfrom the namespace label directly and remove theaz aks listcall and its associated state entirely.Fixes: #280
Testing