Skip to content

fix: adjust how ComponentErrorBoundary wraps components#1236

Merged
asanehisa merged 9 commits into
2026-custom-components-templatesfrom
component-error
Jun 12, 2026
Merged

fix: adjust how ComponentErrorBoundary wraps components#1236
asanehisa merged 9 commits into
2026-custom-components-templatesfrom
component-error

Conversation

@asanehisa

@asanehisa asanehisa commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Instead of wrapping each component in the component code, wrap any components passed through our Edit or Render.

Tested by temporarily forcing the Banner to error
https://github.com/user-attachments/assets/da0c1595-b5b3-4dee-af4f-17548b9bde82

@github-actions

Copy link
Copy Markdown
Contributor

Warning: Component files have been updated but no migrations have been added. See https://github.com/yext/visual-editor/blob/main/packages/visual-editor/src/components/migrations/README.md for more information.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@asanehisa, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 13 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 810027ae-bf8e-477a-bed7-d176277c7986

📥 Commits

Reviewing files that changed from the base of the PR and between f5d1a66 and 7cf7eb4.

📒 Files selected for processing (3)
  • packages/visual-editor/src/internal/components/InternalLayoutEditor.tsx
  • packages/visual-editor/src/internal/utils/wrapConfigWithComponentErrorBoundary.test.tsx
  • packages/visual-editor/src/internal/utils/wrapConfigWithComponentErrorBoundary.tsx

Walkthrough

This PR refactors error-boundary placement from individual page section components to a centralized config-wrapping approach. It introduces wrapConfigWithComponentErrorBoundary to transform Puck component configs by wrapping render functions in ComponentErrorBoundary. A new VisualEditorRender component replaces direct Puck Render usage, applying the wrapper at the entry point. Page section components no longer import or use ComponentErrorBoundary locally. Error messages are updated to reflect configuration-based troubleshooting rather than library updates. The approach consolidates error handling across editors and rendering templates.

Sequence Diagram

sequenceDiagram
  participant ConfigInput as Config Input
  participant wrapConfig as wrapConfigWithComponentErrorBoundary
  participant ComponentErrorBoundary as CEB
  participant VisualEditorRender
  participant PuckRender

  ConfigInput->>wrapConfig: pass original config
  wrapConfig->>wrapConfig: iterate config.components
  wrapConfig->>ComponentErrorBoundary: wrap component.render
  wrapConfig-->>VisualEditorRender: return wrapped config
  VisualEditorRender->>PuckRender: render(wrappedConfig, data)
Loading

Possibly related PRs

  • yext/visual-editor#869: Overlaps directly in ReviewsSection.tsx render logic modification alongside error-boundary refactor.
  • yext/visual-editor#1087: Both PRs modify Breadcrumbs.tsx render tree and wrapper structure.
  • yext/visual-editor#1082: Both PRs update the core render template in packages/visual-editor/src/vite-plugin/templates/base.tsx.

Suggested labels

create-dev-release

Suggested reviewers

  • briantstephan
  • jwartofsky-yext
  • mkilpatrick
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main change: refactoring how ComponentErrorBoundary wraps components by moving error boundaries from individual component code to central entry points.
Description check ✅ Passed The PR description is directly related to the changeset, explaining the architectural shift of error boundary wrapping and including a test reference with video evidence.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch component-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@asanehisa asanehisa marked this pull request as ready for review June 11, 2026 17:04
briantstephan
briantstephan previously approved these changes Jun 11, 2026
Comment thread packages/visual-editor/src/editor/VisualEditorRender.tsx Outdated

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/visual-editor/src/internal/utils/wrapConfigWithComponentErrorBoundary.test.tsx (1)

60-75: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Update stale memoization expectations in this test.

Line 72-75 asserts identity memoization, but wrapConfigWithComponentErrorBoundary now returns a fresh wrapped config for non-empty components. This test will fail against the current implementation contract.

Suggested test update
-  it("memoizes wrapped configs by input identity", () => {
+  it("returns a newly wrapped config on each call", () => {
@@
-    expect(secondWrappedConfig).toBe(firstWrappedConfig);
-    expect(secondWrappedConfig.components.Banner.render).toBe(
-      firstWrappedConfig.components.Banner.render
-    );
+    expect(secondWrappedConfig).not.toBe(firstWrappedConfig);
+    expect(secondWrappedConfig.components.Banner.render).not.toBe(
+      firstWrappedConfig.components.Banner.render
+    );
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/visual-editor/src/internal/utils/wrapConfigWithComponentErrorBoundary.test.tsx`
around lines 60 - 75, The test incorrectly asserts identity memoization for
wrapConfigWithComponentErrorBoundary when config.components is non-empty; update
the test to reflect that a fresh wrapped config is returned for configs with
components: replace the identity assertions (expect(...).toBe(...)) with checks
that the returned config is not the same object as the input but that component
renders are wrapped (e.g., component key exists and its render is a function
distinct from the original render or that calling it returns expected
JSX/error-boundary behavior). Locate wrapConfigWithComponentErrorBoundary and
the test case in wrapConfigWithComponentErrorBoundary.test.tsx and modify
assertions accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@packages/visual-editor/src/internal/utils/wrapConfigWithComponentErrorBoundary.test.tsx`:
- Around line 60-75: The test incorrectly asserts identity memoization for
wrapConfigWithComponentErrorBoundary when config.components is non-empty; update
the test to reflect that a fresh wrapped config is returned for configs with
components: replace the identity assertions (expect(...).toBe(...)) with checks
that the returned config is not the same object as the input but that component
renders are wrapped (e.g., component key exists and its render is a function
distinct from the original render or that calling it returns expected
JSX/error-boundary behavior). Locate wrapConfigWithComponentErrorBoundary and
the test case in wrapConfigWithComponentErrorBoundary.test.tsx and modify
assertions accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 00ccabfd-e7bd-4aa6-bf8c-5d77f76d0197

📥 Commits

Reviewing files that changed from the base of the PR and between 0bb4cb7 and b930e7f.

⛔ Files ignored due to path filters (1)
  • packages/visual-editor/src/components/testing/screenshots/PhotoGallerySection/[desktop] version 59 with showSectionHeading false.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (29)
  • packages/visual-editor/locales/platform/cs/visual-editor.json
  • packages/visual-editor/locales/platform/da/visual-editor.json
  • packages/visual-editor/locales/platform/de/visual-editor.json
  • packages/visual-editor/locales/platform/en-GB/visual-editor.json
  • packages/visual-editor/locales/platform/en/visual-editor.json
  • packages/visual-editor/locales/platform/es/visual-editor.json
  • packages/visual-editor/locales/platform/et/visual-editor.json
  • packages/visual-editor/locales/platform/fi/visual-editor.json
  • packages/visual-editor/locales/platform/fr/visual-editor.json
  • packages/visual-editor/locales/platform/hr/visual-editor.json
  • packages/visual-editor/locales/platform/hu/visual-editor.json
  • packages/visual-editor/locales/platform/it/visual-editor.json
  • packages/visual-editor/locales/platform/ja/visual-editor.json
  • packages/visual-editor/locales/platform/lt/visual-editor.json
  • packages/visual-editor/locales/platform/lv/visual-editor.json
  • packages/visual-editor/locales/platform/nb/visual-editor.json
  • packages/visual-editor/locales/platform/nl/visual-editor.json
  • packages/visual-editor/locales/platform/pl/visual-editor.json
  • packages/visual-editor/locales/platform/pt/visual-editor.json
  • packages/visual-editor/locales/platform/ro/visual-editor.json
  • packages/visual-editor/locales/platform/sk/visual-editor.json
  • packages/visual-editor/locales/platform/sv/visual-editor.json
  • packages/visual-editor/locales/platform/tr/visual-editor.json
  • packages/visual-editor/locales/platform/zh-TW/visual-editor.json
  • packages/visual-editor/locales/platform/zh/visual-editor.json
  • packages/visual-editor/src/editor/VisualEditorRender.tsx
  • packages/visual-editor/src/internal/components/ComponentErrorBoundary.tsx
  • packages/visual-editor/src/internal/utils/wrapConfigWithComponentErrorBoundary.test.tsx
  • packages/visual-editor/src/internal/utils/wrapConfigWithComponentErrorBoundary.tsx
✅ Files skipped from review due to trivial changes (15)
  • packages/visual-editor/locales/platform/en/visual-editor.json
  • packages/visual-editor/locales/platform/es/visual-editor.json
  • packages/visual-editor/locales/platform/de/visual-editor.json
  • packages/visual-editor/locales/platform/da/visual-editor.json
  • packages/visual-editor/locales/platform/cs/visual-editor.json
  • packages/visual-editor/locales/platform/lv/visual-editor.json
  • packages/visual-editor/locales/platform/fr/visual-editor.json
  • packages/visual-editor/locales/platform/et/visual-editor.json
  • packages/visual-editor/locales/platform/it/visual-editor.json
  • packages/visual-editor/locales/platform/zh-TW/visual-editor.json
  • packages/visual-editor/locales/platform/zh/visual-editor.json
  • packages/visual-editor/locales/platform/sv/visual-editor.json
  • packages/visual-editor/locales/platform/sk/visual-editor.json
  • packages/visual-editor/src/internal/components/ComponentErrorBoundary.tsx
  • packages/visual-editor/locales/platform/ro/visual-editor.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/visual-editor/src/editor/VisualEditorRender.tsx

benlife5
benlife5 previously approved these changes Jun 11, 2026
Comment thread packages/visual-editor/locales/platform/en/visual-editor.json Outdated
Comment thread packages/visual-editor/src/editor/Editor.tsx Outdated
Comment thread packages/visual-editor/src/editor/VisualEditorRender.tsx Outdated
@asanehisa asanehisa requested a review from mkilpatrick June 12, 2026 13:22
@asanehisa asanehisa merged commit 67c7baa into 2026-custom-components-templates Jun 12, 2026
17 checks passed
@asanehisa asanehisa deleted the component-error branch June 12, 2026 14:50
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.

4 participants