Skip to content

fix: Handle null owner data in useOwnerPageData hook#4023

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/handle-null-owner-data
Open

fix: Handle null owner data in useOwnerPageData hook#4023
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/handle-null-owner-data

Conversation

@sentry

@sentry sentry Bot commented Jul 7, 2026

Copy link
Copy Markdown

Description

The useOwnerPageData hook's query function was returning undefined when the GraphQL query for owner returned null (e.g., for organizations not found on Codecov). TanStack Query considers undefined an illegal return value, causing an error. This change modifies the queryFn to explicitly return null instead of undefined using the nullish coalescing operator (?? null), which is a valid return value for TanStack Query and prevents the error.

Code Example

Modified queryFn to use the nullish coalescing operator (?? null) to ensure null is returned instead of undefined.

Notable Changes

The useOwnerPageData hook's queryFn now explicitly returns null instead of undefined when the GraphQL owner query result is null. This resolves an error caused by TanStack Query considering undefined an illegal return value.

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-181W

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 25 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.88MB 6 bytes (0.0%) ⬆️
gazebo-production-esm 5.96MB 19 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 19 bytes 641.67kB 0.0%

Files in assets/index.*.js:

  • ./src/pages/OwnerPage/hooks/useOwnerPageData.js → Total Size: 612 bytes
view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 6 bytes 719.12kB 0.0%

Files in assets/index-legacy.*.js:

  • ./src/pages/OwnerPage/hooks/useOwnerPageData.js → Total Size: 612 bytes

@codecov-public-qa

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3542 1 3541 2
View the top 1 failed test(s) by shortest run time
src/App.test.tsx > App > cloud routing > renders the PullRequestPage page
Stack Traces | 1.03s run time
TestingLibraryElementError: Unable to find an element with the text: /PullRequestPage/i. 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="light"
>
  <div>
    <div
      class="mt-16 flex flex-1 items-center justify-center"
    >
      <span
        class="relative flex size-20"
      >
        <span
          class="absolute inline-flex size-full rounded-full bg-ds-pink-default opacity-50 motion-safe:animate-ping"
        />
        <span
          class="relative inline-flex size-20 rounded-full bg-ds-background"
        >
          <img
            alt="Codecov Logo"
            class="p-1"
            src="....../src/assets/codecov_logo.png"
          />
        </span>
      </span>
    </div>
    <div
      style="position: fixed; z-index: 9999; top: 16px; left: 16px; right: 16px; bottom: 16px; pointer-events: none;"
    />
  </div>
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div>
    <div
      class="mt-16 flex flex-1 items-center justify-center"
    >
      <span
        class="relative flex size-20"
      >
        <span
          class="absolute inline-flex size-full rounded-full bg-ds-pink-default opacity-50 motion-safe:animate-ping"
        />
        <span
          class="relative inline-flex size-20 rounded-full bg-ds-background"
        >
          <img
            alt="Codecov Logo"
            class="p-1"
            src="....../src/assets/codecov_logo.png"
          />
        </span>
      </span>
    </div>
    <div
      style="position: fixed; z-index: 9999; top: 16px; left: 16px; right: 16px; bottom: 16px; pointer-events: none;"
    />
  </div>
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
src/App.test.tsx:399:35

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4282 1 4281 2
View the top 1 failed test(s) by shortest run time
src/App.test.tsx > App > cloud routing > renders the PullRequestPage page
Stack Traces | 1.03s run time
TestingLibraryElementError: Unable to find an element with the text: /PullRequestPage/i. 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="light"
>
  <div>
    <div
      class="mt-16 flex flex-1 items-center justify-center"
    >
      <span
        class="relative flex size-20"
      >
        <span
          class="absolute inline-flex size-full rounded-full bg-ds-pink-default opacity-50 motion-safe:animate-ping"
        />
        <span
          class="relative inline-flex size-20 rounded-full bg-ds-background"
        >
          <img
            alt="Codecov Logo"
            class="p-1"
            src="....../src/assets/codecov_logo.png"
          />
        </span>
      </span>
    </div>
    <div
      style="position: fixed; z-index: 9999; top: 16px; left: 16px; right: 16px; bottom: 16px; pointer-events: none;"
    />
  </div>
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div>
    <div
      class="mt-16 flex flex-1 items-center justify-center"
    >
      <span
        class="relative flex size-20"
      >
        <span
          class="absolute inline-flex size-full rounded-full bg-ds-pink-default opacity-50 motion-safe:animate-ping"
        />
        <span
          class="relative inline-flex size-20 rounded-full bg-ds-background"
        >
          <img
            alt="Codecov Logo"
            class="p-1"
            src="....../src/assets/codecov_logo.png"
          />
        </span>
      </span>
    </div>
    <div
      style="position: fixed; z-index: 9999; top: 16px; left: 16px; right: 16px; bottom: 16px; pointer-events: none;"
    />
  </div>
</body>
 ❯ waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27
 ❯ node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ src/App.test.tsx:399:35

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
309c923 Tue, 07 Jul 2026 11:42:36 GMT Cloud Enterprise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant