Skip to content

fix(onboarding): Prevent entire docs object from rendering as React child#115876

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/jest-28h7-onboarding-render-crash
Draft

fix(onboarding): Prevent entire docs object from rendering as React child#115876
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/jest-28h7-onboarding-render-crash

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 20, 2026

This PR addresses an issue where the entire docs configuration object was being passed as a React child, leading to a runtime error: "Objects are not valid as a React child".

The root cause was identified as a combination of:

  1. The docs object (specifically for Elixir, but potentially other platforms) not strictly conforming to the Docs interface, allowing non-step objects to be returned by install, configure, or verify functions.
  2. Insufficient defensive checks in OnboardingLayout, Step.tsx, and ContentBlocksRenderer to handle such malformed inputs.

To fix this, the following changes were implemented:

  • static/app/components/onboarding/gettingStartedDoc/contentBlocks/utils.tsx: Added checks in renderBlocks to ensure contentBlocks is an array and each block is a valid object with a string type and a registered renderer. Malformed blocks are now skipped.
  • static/app/components/onboarding/gettingStartedDoc/step.tsx: Ensured that the content prop passed to ContentBlocksRenderer is always an array, coercing it to an empty array if it's not.
  • static/app/components/onboarding/gettingStartedDoc/onboardingLayout.tsx: Introduced a safeCall helper to wrap calls to doc.install, doc.configure, and doc.verify. This helper ensures that these functions are called only if they exist and that their return values are arrays of OnboardingSteps. Additionally, a defensive check was added within the steps.map loop to skip rendering any step object that does not have a valid title or type string, preventing the entire Docs literal from being spread into <StyledStep />.

These changes make the onboarding rendering process more robust by defensively validating the shape of the docs configuration and ensuring that only valid React nodes or OnboardingStep objects are processed for rendering.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here 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 Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes JEST-28H7

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.56%

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

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants