Add error boundary with diagnostics - #58
Open
moshloop wants to merge 2 commits into
Open
Conversation
Give consumers a shared full-page fallback for uncaught React errors, with normalized diagnostics and support-ready clipboard reporting. Include tests and Storybook coverage for successful and failed copy flows. Claude-Session-Id: 208885f0-1dd9-44f9-9b16-0d59284bd391
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughChangesErrorWrapper
Session viewer icon
Sequence Diagram(s)sequenceDiagram
participant BrokenPage
participant ErrorWrapper
participant Clipboard
BrokenPage->>ErrorWrapper: throw render error
ErrorWrapper->>ErrorWrapper: normalize diagnostics
ErrorWrapper-->>BrokenPage: render accessible fallback
ErrorWrapper->>Clipboard: write formatted error report
Clipboard-->>ErrorWrapper: resolve or reject copy request
ErrorWrapper-->>BrokenPage: announce copy status
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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.
Inline comments:
In `@packages/ui/src/components/ErrorWrapper.stories.tsx`:
- Around line 40-53: Add Storybook interaction coverage alongside the Default
story for both ErrorWrapper copy outcomes: click “Copy error details” and assert
the successful copied status, then cover clipboard failure and assert its
failure status. Reuse the existing ErrorWrapper/BrokenDashboard setup and
Storybook play-function patterns, keeping the fallback rendering assertions
intact.
In `@packages/ui/src/components/ErrorWrapper.test.tsx`:
- Around line 19-22: Restore the original navigator.clipboard property
descriptor in the afterEach cleanup for ErrorWrapper tests, since
vi.restoreAllMocks() does not undo Object.defineProperty changes. At
packages/ui/src/components/ErrorWrapper.test.tsx lines 19-22, capture and
restore the original descriptor; at lines 60-63, use the restored test fixture
so no replacement remains globally installed.
In `@packages/ui/src/components/ErrorWrapper.tsx`:
- Around line 191-192: Update the page URL handling in ErrorWrapper to copy only
window.location.origin and pathname, excluding query strings and fragments from
the support report. Preserve the existing conditional behavior and update the
related test to assert that both search parameters and hash fragments are
omitted.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7a153742-29ef-41e7-abf2-4fa3037e5429
📒 Files selected for processing (4)
packages/ui/src/components.tspackages/ui/src/components/ErrorWrapper.stories.tsxpackages/ui/src/components/ErrorWrapper.test.tsxpackages/ui/src/components/ErrorWrapper.tsx
Contributor
Gavel summary
Totals: 2745 passed · 0 failed · 1 skipped · 5m38s |
Keep query parameters and URL fragments out of copied diagnostics to prevent accidental credential disclosure. Add coverage for clipboard outcomes and align session user visuals with the standard icon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a reusable error boundary component with copyable diagnostics for uncaught React errors.
What
Why
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Tests