Skip to content

refactor: add error wrapper to campaign banner - #3478

Open
RocioCM wants to merge 3 commits into
masterfrom
fix/install-contentful-rich-text-renderer
Open

RocioCM wants to merge 3 commits into
masterfrom
fix/install-contentful-rich-text-renderer

Conversation

@RocioCM

@RocioCM RocioCM commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

What

  • The Builder no longer renders a blank page when a Contentful campaign banner with rich text is active (currently reproducible on decentraland.zone/builder).
  • If a campaign banner ever fails to render for any other reason, the page now simply omits the banner instead of crashing the whole app.

Why

The campaign banner lazily loads @contentful/rich-text-react-renderer, an optional peer dependency of decentraland-ui2 that was never installed. Vite silently bundled the unresolved import as an empty stub module, so rendering any banner with rich text threw documentToReactComponents is not a function and, with no error boundary above it, blanked the entire app.

How to test

  1. Open decentraland.zone/builder on a build of master: the page is blank with the TypeError above in the console.
  2. On this branch, build and load the app with an active campaign banner: the banner renders its rich text and the rest of the page works.
  3. Locally, note the campaign fetch is CORS-blocked for localhost origins, so the banner only appears when the app is served from a decentraland domain (or with CORS disabled). A quick mechanism check without a browser: after npm ci && npx vite build, dist/assets/rich-text-react-renderer*.js is the real ~11KB module on this branch versus a 33-byte empty stub on master.

RocioCM and others added 2 commits August 24, 2026 09:55
…rom campaign banner

The campaign banner (decentraland-ui2 Banner) lazily imports
@contentful/rich-text-react-renderer, an optional peer dependency that
was never installed. Vite silently bundled the unresolved import as an
empty stub module, so rendering any banner with rich text crashed with
"documentToReactComponents is not a function" and, with no error
boundary above it, blanked the whole app (currently reproducible on
decentraland.zone/builder).

Install the package so the import resolves to the real renderer, and
wrap the banner usages in an error boundary so a broken banner degrades
to no banner instead of taking down the page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
builder Ready Ready Preview Aug 24, 2026 2:50pm

Request Review

@RocioCM RocioCM changed the title fix: install @contentful/rich-text-react-renderer to fix blank page from campaign banner hotfix: fix blank page from campaign banner Aug 24, 2026
@RocioCM RocioCM changed the title hotfix: fix blank page from campaign banner fix: hotfix blank page from campaign banner Aug 24, 2026

@decentraland-bot decentraland-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Verdict: ✅ Approve

Clean, well-scoped fix for a production-impacting bug (blank page when a Contentful campaign banner with rich text is active).

Changes Reviewed

File Assessment
package.json ✅ Correctly adds @contentful/rich-text-react-renderer as a production dependency — this was a missing peer dep of decentraland-ui2 that Vite silently stubbed as an empty module
src/components/CampaignBanner/ (3 files) ✅ Clean error boundary wrapper following project conventions (component + types + barrel export)
src/components/HomePage/HomePage.tsx ✅ Banner replaced with CampaignBanner
src/components/CollectionsPage/CollectionsPage.tsx ✅ Banner replaced with CampaignBanner
package-lock.json ✅ Lock file consistent with dependency addition

Analysis

Root cause fix — Installing the missing @contentful/rich-text-react-renderer peer dependency resolves the documentToReactComponents is not a function TypeError that was crashing the page.

Defense-in-depth — The CampaignBanner error boundary is a good addition: if a campaign banner ever fails to render for any reason, the page degrades gracefully (banner disappears) instead of going blank. Class component usage is correct — React requires class components for error boundaries.

Architecture — Error boundary is placed at the right granularity. A single reusable wrapper (CampaignBanner) avoids duplicating boundary logic at each of the two usage sites. Both existing Banner usage sites in the codebase are covered.

Component structure — The 3-file pattern (.tsx + .types.ts + index.ts) matches the project's established component conventions.

Security

No security issues found. No hardcoded secrets, no XSS surface (only a string id prop is passed), no dangerouslySetInnerHTML, and @contentful/rich-text-react-renderer is a well-maintained package with no known vulnerabilities.

CI Status

Audit, test, and Vercel checks are still running at time of review.

Findings

No P0 or P1 issues. No P2 findings worth flagging — the implementation is minimal and correct.


Reviewed by Jarvis 🤖 · Requested by RocioCM via GitHub

@RocioCM RocioCM changed the title fix: hotfix blank page from campaign banner refactor: add error wrapper to campaign banner Aug 24, 2026
@coveralls

coveralls commented Aug 24, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 32740931716

Coverage remained the same at 53.595%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13244
Covered Lines: 7711
Line Coverage: 58.22%
Relevant Branches: 5991
Covered Branches: 2598
Branch Coverage: 43.37%
Branches in Coverage %: Yes
Coverage Strength: 37.66 hits per line

💛 - Coveralls

This branch was successfully deployed

1 active deployment
Preview — 73f1185a Deployed Aug 24, 2026 by vercel[bot]
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.

3 participants