manager icon indicating copy to clipboard operation
manager copied to clipboard

fix: [APL-272] - useGetAPLAvailability does not check for beta enrollment

Open dennisvankekem opened this issue 1 year ago • 3 comments

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

dennisvankekem avatar Oct 16 '24 08:10 dennisvankekem

Coverage Report:
Base Coverage: 87.01%
Current Coverage: 87.01%

github-actions[bot] avatar Oct 16 '24 08:10 github-actions[bot]

@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.

dennisvankekem avatar Oct 17 '24 12:10 dennisvankekem

@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.

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.

dwiley-akamai avatar Oct 17 '24 16:10 dwiley-akamai

Pushed a small commit to clean up the React Query layer for account betas. Shouldn't cause any change to the APL behavior

bnussman-akamai avatar Oct 23 '24 14:10 bnussman-akamai

Cloud Manager E2E    Run #6722

Run Properties:  status check passed Passed #6722  •  git commit 722e16b558: fix: [APL-272] - Make `useAPLAvailability` check for beta enrollment (#11110)
Project Cloud Manager E2E
Branch Review develop
Run status status check passed Passed #6722
Run duration 28m 09s
Commit git commit 722e16b558: fix: [APL-272] - Make `useAPLAvailability` check for beta enrollment (#11110)
Committer Dennis van Kekem
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 438
View all changes introduced in this branch ↗︎

cypress[bot] avatar Oct 23 '24 17:10 cypress[bot]