-
Notifications
You must be signed in to change notification settings - Fork 17
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: Quick Refactor to Parse the Whole Response of Converted Hooks #2208
ref: Quick Refactor to Parse the Whole Response of Converted Hooks #2208
Conversation
✅ Deploy Preview for gazebo-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov Report
@@ Coverage Diff @@
## main #2208 +/- ##
=======================================
Coverage 97.94% 97.94%
=======================================
Files 698 698
Lines 7926 7929 +3
Branches 1887 1892 +5
=======================================
+ Hits 7763 7766 +3
Misses 161 161
Partials 2 2 Continue to review full report in Codecov by Sentry.
|
Codecov Report
@@ Coverage Diff @@
## main #2208 +/- ##
=====================================
Coverage 97.94 97.94
=====================================
Files 698 698
Lines 7926 7929 +3
Branches 1887 1892 +5
=====================================
+ Hits 7763 7766 +3
Misses 161 161
Partials 2 2
Continue to review full report in Codecov by Sentry.
|
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.
two quick comments
@@ -132,7 +138,7 @@ export const useCommitHeaderData = ({ | |||
} | |||
|
|||
return { | |||
commit: data?.repository?.commit, | |||
commit: data?.owner?.repository?.commit ?? null, |
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.
so just so i understand this better, we can't return undefined 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.
It's because of the way that GraphQL works. If you request a field it will either return the value or null
it will never return undefined
so we don't wan't the TS value to reflect something it could never be. Which if we set to undefined here it won't pass the type validation that zod runs and will error out.
]) | ||
.nullable(), | ||
}) | ||
.nullable(), |
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.
do we plan to take out the queries to their own files?
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 don't see any benefit as to removing the queries as when they're only used in a single location. I also think it's somewhat of a bad practice in these instances to move a string to it's own file.
…2208) Quick refactor to parse the whole response over just smaller portions.
Description
This quick refactor updates hooks that have already been converted over to use the new
repository
field to slightly adjust the return value as well as parse the whole response rather then a small portion.Notable Changes
useCommitHeaderData
useCommitPageData
usePullHeadData
usePullPageData