You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses a ZodError occurring in the useUser hook when UserSchema.safeParse receives undefined.
Code Example
Notable Changes
Problem: The GraphQL API can return a 200 HTTP status code, but with a response body containing only an errors field (e.g., {"errors": [...]}) and no data field. Previously, the graphql() function in src/shared/api/api.ts would resolve the promise with this errors-only response. When res?.data was accessed in useUser, it would evaluate to undefined, leading to UserSchema.safeParse(undefined) and the observed ZodError.
Solution: The graphql() function in src/shared/api/api.ts has been modified. It now explicitly rejects the promise if a GraphQL response (even with a 200 status) contains errors but lacks a data field. This ensures that downstream consumers, such as the useUser hook and its Zod schema validation, never receive undefined when an object is expected, thereby preventing the ZodError.
Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
View the top 1 failed test(s) by shortest run time
src/pages/AccountSettings/tabs/YAML/YAML.test.jsx > YAMLTab > The api fails > The save button becomes unsaved changes and an error is displayed
Stack Traces | 1.06s run time
TestingLibraryElementError: Unable to find an element with the text: /Something went wrong/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body
class=""
>
<div />
</body>
Ignored nodes: comments, script, style
<body
class=""
>
<div />
</body>
❯ waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27
❯ node_modules/@.../dom/dist/query-helpers.js:86:33
❯ .../tabs/YAML/YAML.test.jsx:225:47
Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses a
ZodErroroccurring in theuseUserhook whenUserSchema.safeParsereceivesundefined.Code Example
Notable Changes
Problem: The GraphQL API can return a 200 HTTP status code, but with a response body containing only an
errorsfield (e.g.,{"errors": [...]}) and nodatafield. Previously, thegraphql()function insrc/shared/api/api.tswould resolve the promise with thiserrors-only response. Whenres?.datawas accessed inuseUser, it would evaluate toundefined, leading toUserSchema.safeParse(undefined)and the observedZodError.Solution: The
graphql()function insrc/shared/api/api.tshas been modified. It now explicitly rejects the promise if a GraphQL response (even with a 200 status) containserrorsbut lacks adatafield. This ensures that downstream consumers, such as theuseUserhook and its Zod schema validation, never receiveundefinedwhen an object is expected, thereby preventing theZodError.Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes GAZEBO-1879
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry. You can adjust this setting at any time.