fix: [APL-272] - useGetAPLAvailability does not check for beta enrollment
Description 📝
The APL feature has recently been merged. Due to misunderstanding of the beta feature it was merged without the required check if the user is enrolled in the beta program and if said beta program is currently active.
Changes 🔄
List any change relevant to the reviewer.
- useGetAPLAvailability extended with beta check
- test written for useGetAPLAvailability's beta checkl
Target release date 🗓️
October 28th, 2024 (for develop)
How to test 🧪
- simply run test in kubeutils.test.ts
Coverage Report: ✅
Base Coverage: 87.01%
Current Coverage: 87.01%
@dwiley-akamai could you please give a little bit more detail as to why passing enabled to the query is the best practice to disable the unnecessary apl requests? Looking at the enabled property on the useQuery it reads Set this to false or a function that returns false to disable automatic refetching when the query mounts or changes query keys. To refetch the query, use the refetch method returned from the useQuery instance. Accepts a boolean or function that returns a boolean. Defaults to true.
isn't it better to return an early false statement whenever the feature flag is false (even though TS doesn't like conditional hook calls).
Just curious as to why this works.
@dwiley-akamai could you please give a little bit more detail as to why passing enabled to the query is the best practice to disable the unnecessary apl requests? Looking at the enabled property on the
useQueryit readsSet this to false or a function that returns false to disable automatic refetching when the query mounts or changes query keys. To refetch the query, use the refetch method returned from the useQuery instance. Accepts a boolean or function that returns a boolean. Defaults to true.isn't it better to return an early false statement whenever the feature flag is false (even though TS doesn't like conditional hook calls).
Just curious as to why this works.
enabled being false prevents the query from automatically running. When the feature flag is off, we definitely wouldn't want to make those API calls unnecessarily. Hypothetically, it would be nice to just return false whenever the feature flag is false, but more than TS not liking conditional hook calls, we can't call hooks conditionally because it's a violation of how hooks work in React.
Pushed a small commit to clean up the React Query layer for account betas. Shouldn't cause any change to the APL behavior
Cloud Manager E2E
Run #6722
Run Properties:
Passed #6722 •
722e16b558: fix: [APL-272] - Make `useAPLAvailability` check for beta enrollment (#11110)
| Project |
Cloud Manager E2E
|
| Branch Review |
develop
|
| Run status |
|
| Run duration | 28m 09s |
| Commit |
|
| Committer | Dennis van Kekem |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
2
|
|
|
2
|
|
|
0
|
|
|
438
|
| View all changes introduced in this branch ↗︎ | |