Skip to content

fix(ownerpage): Handle undefined owner data in useOwnerPageData hook - #4075

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gazebo-181w-owner-data
Open

fix(ownerpage): Handle undefined owner data in useOwnerPageData hook#4075
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gazebo-181w-owner-data

Conversation

@sentry

@sentry sentry Bot commented Aug 8, 2026

Copy link
Copy Markdown

Description

This PR addresses GAZEBO-181W by modifying the useOwnerPageData hook in src/pages/OwnerPage/hooks/useOwnerPageData.js.

Previously, the queryFn could return undefined if res?.data?.owner was not present, which causes TanStack Query to crash as it explicitly disallows undefined as a query result.

This change reintroduces the nullish coalescing operator (?? null) to ensure that null is returned instead of undefined when owner data is missing. This restores the intended behavior and prevents the application from crashing, aligning with a previous fix from PR 4023.

Code Example

// Before (causing crash if res?.data?.owner is undefined)
queryFn: async ({ queryKey }) => {
  const [, ownerId] = queryKey;
  const res = await getOwnerData(ownerId);
  return res?.data?.owner; // Could be undefined
}

// After (reintroducing nullish coalescing)
queryFn: async ({ queryKey }) => {
  const [, ownerId] = queryKey;
  const res = await getOwnerData(ownerId);
  return res?.data?.owner ?? null; // Ensures null instead of undefined
}

Notable Changes

  • Modified src/pages/OwnerPage/hooks/useOwnerPageData.js.
  • Reintroduced the nullish coalescing operator (?? null) in the queryFn of useOwnerPageData.
  • Ensures that null is returned instead of undefined when owner data is missing, preventing TanStack Query from crashing.
  • Aligns with the fix implemented in PR 4023.

Screenshots

N/A

Link to Sample Entry

N/A

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 Aug 8, 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.81MB 6 bytes (0.0%) ⬆️
gazebo-production-esm 5.89MB 19 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

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

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

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

Assets Changed:

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

Files in assets/index.*.js:

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

@codecov-notifications

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #4075   +/-   ##
=======================================
  Coverage   98.76%   98.76%           
=======================================
  Files         822      822           
  Lines       15092    15092           
  Branches     4351     4360    +9     
=======================================
  Hits        14906    14906           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
src/pages/OwnerPage/hooks/useOwnerPageData.js 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.42% <100.00%> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update faad269...185cd1a. Read the comment docs.

@codecov-public-qa

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.76%. Comparing base (faad269) to head (185cd1a).

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #4075   +/-   ##
=======================================
  Coverage   98.76%   98.76%           
=======================================
  Files         822      822           
  Lines       15092    15092           
  Branches     4359     4352    -7     
=======================================
  Hits        14906    14906           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
src/pages/OwnerPage/hooks/useOwnerPageData.js 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.42% <100.00%> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update faad269...185cd1a. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.76%. Comparing base (faad269) to head (185cd1a).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4075   +/-   ##
=======================================
  Coverage   98.76%   98.76%           
=======================================
  Files         822      822           
  Lines       15092    15092           
  Branches     4351     4360    +9     
=======================================
  Hits        14906    14906           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
src/pages/OwnerPage/hooks/useOwnerPageData.js 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.42% <100.00%> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update faad269...185cd1a. Read the comment docs.

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
185cd1a Sat, 08 Aug 2026 10:51:22 GMT Cloud Enterprise

@codecov-qa

codecov-qa Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.76%. Comparing base (faad269) to head (185cd1a).

@@           Coverage Diff           @@
##             main    #4075   +/-   ##
=======================================
  Coverage   98.76%   98.76%           
=======================================
  Files         822      822           
  Lines       15092    15092           
  Branches     4359     4352    -7     
=======================================
  Hits        14906    14906           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
src/pages/OwnerPage/hooks/useOwnerPageData.js 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.42% <100.00%> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update faad269...185cd1a. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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