-
Notifications
You must be signed in to change notification settings - Fork 24
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
ref: Migrate useUpdateOktaConfig to TSQ V5 #3697
ref: Migrate useUpdateOktaConfig to TSQ V5 #3697
Conversation
Bundle ReportChanges will decrease total bundle size by 244 bytes (-0.0%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: gazebo-staging-systemAssets Changed:
Files in
view changes for bundle: gazebo-staging-esmAssets Changed:
Files in
|
Bundle ReportChanges will decrease total bundle size by 244 bytes (-0.0%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: gazebo-production-esmAssets Changed:
Files in
view changes for bundle: gazebo-production-systemAssets Changed:
Files in
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #3697 +/- ##
==========================================
+ Coverage 98.75% 98.76% +0.01%
==========================================
Files 828 828
Lines 14875 14872 -3
Branches 4230 4226 -4
==========================================
- Hits 14690 14689 -1
+ Misses 176 174 -2
Partials 9 9
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3697 +/- ##
==========================================
+ Coverage 98.71% 98.73% +0.01%
==========================================
Files 828 828
Lines 14891 14888 -3
Branches 4229 4225 -4
==========================================
- Hits 14700 14699 -1
+ Misses 182 180 -2
Partials 9 9
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3697 +/- ##
==========================================
+ Coverage 98.71% 98.73% +0.01%
==========================================
Files 828 828
Lines 14891 14888 -3
Branches 4229 4225 -4
==========================================
- Hits 14700 14699 -1
+ Misses 182 180 -2
Partials 9 9
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3697 +/- ##
==========================================
+ Coverage 98.71% 98.73% +0.01%
==========================================
Files 828 828
Lines 14891 14888 -3
Branches 4237 4233 -4
==========================================
- Hits 14700 14699 -1
+ Misses 182 180 -2
Partials 9 9
Continue to review full report in Codecov by Sentry.
|
__typename | ||
... on UnauthorizedError { | ||
message | ||
} | ||
... on ValidationError { | ||
message | ||
} | ||
... on UnauthenticatedError { | ||
message |
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.
Because __typename
is a valid field on every GQL type, if we define it in the top here, it will be automatically included in all of the spread for the different union types.
const ErrorUnionSchema = z.discriminatedUnion('__typename', [ | ||
z.object({ | ||
__typename: z.literal('UnauthorizedError'), | ||
message: z.string(), | ||
}), | ||
z.object({ | ||
__typename: z.literal('ValidationError'), | ||
message: z.string(), | ||
}), | ||
z.object({ | ||
__typename: z.literal('UnauthenticatedError'), | ||
message: z.string(), | ||
}), | ||
]) |
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.
Updated to use a discriminatedUnion
because it is significantly more efficient over union
. discriminatedUnion
uses the first argument as the "check" field to match the the value being parsed instead of iterating over every single field to find the correct type.
You can read more about discriminatedUnion
here
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 thought i'd also bring this out into it's own type, just to make things look a little cleaner.
if ( | ||
error.__typename === 'ValidationError' || | ||
error.__typename === 'UnauthorizedError' || | ||
error.__typename === 'UnauthenticatedError' | ||
) { |
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 removed this error, because after testing if the mutation is successful then error is null
, so we should show the toast if error
is defined.
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
Description
This PR migrates
useUpdateOktaConfig
to TSQ V5, and tidies up some logic within the hook.Ticket: codecov/engineering-team#2963
Notable Changes
useUpdateOktaConfig
to use TSQ V5useUpdateOktaConfig
testsOktaConfigForm
to useProvider
type (as it was updated as the arg to be passed inuseUpdateOktaConfig
)