-
Notifications
You must be signed in to change notification settings - Fork 17
fix(Header): wait for capabilities before show content #3145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 3 comments
| return Boolean(data || error); | ||
| } | ||
|
|
||
| export function useAllCapablitiesStatus() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: typo: 'Capablities' should be 'Capabilities'
| export function useAllCapablitiesStatus() { | |
| export function useAllCapabilitiesStatus() { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/store/reducers/capabilities/hooks.ts
Line: 33:33
Comment:
**syntax:** typo: 'Capablities' should be 'Capabilities'
```suggestion
export function useAllCapabilitiesStatus() {
```
How can I resolve this? If you propose a fix, please make it concise.
src/containers/App/Content.tsx
Outdated
| import {authenticationApi} from '../../store/reducers/authentication/authentication'; | ||
| import { | ||
| useCapabilitiesQuery, | ||
| useAllCapablitiesStatus, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: typo: 'Capablities' should be 'Capabilities'
| useAllCapablitiesStatus, | |
| useAllCapabilitiesStatus, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/containers/App/Content.tsx
Line: 17:17
Comment:
**syntax:** typo: 'Capablities' should be 'Capabilities'
```suggestion
useAllCapabilitiesStatus,
```
How can I resolve this? If you propose a fix, please make it concise.
src/containers/Header/Header.tsx
Outdated
| import {environment} from '../../store'; | ||
| import { | ||
| useAddClusterFeatureAvailable, | ||
| useAllCapablitiesStatus, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: typo: 'Capablities' should be 'Capabilities'
| useAllCapablitiesStatus, | |
| useAllCapabilitiesStatus, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/containers/Header/Header.tsx
Line: 22:22
Comment:
**syntax:** typo: 'Capablities' should be 'Capabilities'
```suggestion
useAllCapabilitiesStatus,
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this 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 addresses a timing issue where the Header component could render before capabilities data is fully loaded. A new custom hook useAllCapablitiesStatus centralizes the logic for checking both cluster and meta capabilities loading status, which is then used to conditionally render Header content.
Key changes:
- Created a reusable hook to check the combined loading state of both capabilities queries
- Modified Header to wait for capabilities to load before rendering its content
- Refactored Content.tsx to use the new hook, eliminating code duplication
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/store/reducers/capabilities/hooks.ts | Introduces new hook useAllCapablitiesStatus to centralize capabilities loading state checking |
| src/containers/Header/Header.tsx | Updates Header to wait for capabilities before rendering content using the new hook |
| src/containers/App/Content.tsx | Refactors to use the new centralized hook, removing duplicated logic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, no comments
| // It is always true if there is no meta, since request finishes with an error | ||
| const metaCapabilitiesLoaded = useMetaCapabilitiesLoaded(); | ||
|
|
||
| const capabilitiesLoaded = Boolean(data || error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is hook useCapabilitiesLoaded for capabilities. So you can use:
useCapabilitiesQuery()
useMetaCapabilitiesQuery()
const capabilitiesLoaded = useCapabilitiesLoaded()
const metaCapabilitiesLoaded = useMetaCapabilitiesLoaded()
It doesn't change much, but it hide loading logic within one hook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! i've totally forgot abt this hook. Reworked logic a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, no comments
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 66.06 MB | Main: 66.06 MB
Diff: +0.59 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information