-
Notifications
You must be signed in to change notification settings - Fork 367
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
tech-story: [M3-8939] - Get rid of DrawerContent
#11338
Conversation
errorText={Array.isArray(error) ? error[0].reason : error} | ||
/> | ||
) | ||
) : isFetching ? ( |
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.
addition of error handling is the change here
const { classes, cx } = useStyles(); | ||
const { children, isFetching, onClose, open, title, wide, ...rest } = props; | ||
const titleID = convertForAria(title); | ||
export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>( |
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.
this change indentation but is a minor change
this should remove A LOT of warnings through the APP with mounted drawers
data: data, | ||
error: isErrorKubernetesACL, | ||
isLoading: isLoadingKubernetesACL, | ||
} = useKubernetesControlPlaneACLQuery(clusterId, showControlPlaneACL); |
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.
We are already fetching this in the summary, so this query is moot. Error handling is also handled in the summary. We can just receive the acl Data as a prop and use the data for the drawer. This is a place where it does make sense to do so
/> | ||
)} | ||
control={control} | ||
name="acl.enabled" | ||
name="acl.revision-id" |
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.
diff looks that way, but none of this was changed
@@ -196,15 +196,15 @@ export const useAllKubernetesClusterAPIEndpointsQuery = (id: number) => { | |||
}); | |||
}; | |||
|
|||
export const useKubenetesKubeConfigQuery = ( | |||
export const useKubernetesKubeConfigQuery = ( |
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.
that typo bothered me!
// refetchOnMount isnt good enough for this query because | ||
// it is already mounted in the rendered Drawer | ||
React.useEffect(() => { | ||
if (open && !isLoading && !isFetching) { | ||
refetch(); | ||
} | ||
}, [open]); |
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.
Was this removal intentional?
Wondering if we should adopt this pattern here so we can actually use React Query's refetchOnMount
If I'm remembering correctly, we wanted the refetching of the bube config to intentionally be aggressive so that there would be less of a chance of the user seeing an old kube config in the case they re-generate it
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.
it seemed like a bad pattern to me - i'll look around and test this some more.
less of a chance of the user seeing an old kube config in the case they re-generate it
is there a reason why this does not get invalidated properly?
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.
I think this is cleaner? 06b5690
Also makes sure this issue wouldn't be happening in other places it is used
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.
We do invalidate the kube config but, if I remember correctly, the kube config takes some time (a few minutes) on the backend to actually be regenerated
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.
That works too!
Coverage Report: ❌ |
Cloud Manager UI test results🎉 462 passing tests on test run #7 ↗︎
|
expect(backupItem).toBeVisible(); | ||
} | ||
}); |
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.
This a pattern we ought to employ instead of await in loops to avoid flakiness (esp with dates). Hopefully this fixes this one for good
clusterId: number, | ||
enabled = false | ||
) => | ||
useQuery<string, APIError[]>({ | ||
...kubernetesQueries.cluster(clusterId)._ctx.kubeconfig, | ||
enabled, | ||
refetchOnMount: true, | ||
retry: true, |
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.
We should prob be careful with retry: true
as it will fetch indefinitely and not return the 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.
thank you!
✅ confirmed lke drawers
✅ managed monitor history drawer
Cloud Manager E2E Run #6906
Run Properties:
|
Project |
Cloud Manager E2E
|
Branch Review |
develop
|
Run status |
Passed #6906
|
Run duration | 29m 51s |
Commit |
2581eb55a2: tech-story: [M3-8939] - Get rid of `DrawerContent` (#11338)
|
Committer | Alban Bailly |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
5
|
Pending |
2
|
Skipped |
0
|
Passing |
465
|
View all changes introduced in this branch ↗︎ |
Description 📝
Small PR as a follow up to #11273 (loading patterns in Drawer) to clean up remaining legacy Drawer patterns.
DrawerContent
was meant to handle loading states and errors, which is not handled directly withinDrawer
🧹Changes 🔄
DrawerContent
useKubernetesKubeConfigQuery
typoPreview 📷
No visual changes/regressions expected as part fo this PR
How to test 🧪
Verification steps
/kubernetes/clusters/{id}/summary
/managed/monitors
)Author Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅