Skip to content

Conversation

@seanrcollings
Copy link
Contributor

@seanrcollings seanrcollings commented Dec 18, 2025

Adds a geneeric ErrorBoundary component

Static Fallback

The simplest usage is with a static fallback UI:

import { ErrorBoundary } from "@atomicjolt/atomic-elements";

function App() {
  return (
    <ErrorBoundary fallback={<div>Something went wrong!</div>}>
      <MyComponent />
    </ErrorBoundary>
  );
}

Function Fallback

For more dynamic error handling, use a function fallback:

function App() {
  return (
    <ErrorBoundary
      fallback={(error, reset) => (
        <div>
          <h2>Oops! Something went wrong</h2>
          <p>Error: {error.message}</p>
          <button onClick={reset}>Try again</button>
        </div>
      )}
    >
      <MyComponent />
    </ErrorBoundary>
  );
}

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an ErrorBoundary component to the atomic-elements package, providing error handling capabilities for React applications. The ErrorBoundary component allows developers to catch JavaScript errors in their component tree, display fallback UI, and optionally reset the error state.

Key Changes:

  • Added new ErrorBoundary component with support for static and functional fallback UI
  • Includes comprehensive test coverage and Storybook documentation
  • Version bumped from 3.5.x to 3.6.0 for atomic-elements and updated forms package dependency

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/atomic-elements/src/components/Feedback/ErrorBoundary/ErrorBoundary.component.tsx Core ErrorBoundary implementation as a React class component with error catching, reset functionality, and resetKeys support
packages/atomic-elements/src/components/Feedback/ErrorBoundary/index.tsx Public exports for ErrorBoundary component and types
packages/atomic-elements/src/components/Feedback/ErrorBoundary/ErrorBoundary.spec.tsx Comprehensive test suite covering error catching, fallback rendering, reset functionality, and resetKeys behavior
packages/atomic-elements/src/components/Feedback/ErrorBoundary/ErrorBoundary.stories.tsx Storybook stories demonstrating various ErrorBoundary use cases including static/function fallbacks, resetKeys, and nested boundaries
packages/atomic-elements/src/components/index.ts Added ErrorBoundary exports to main component index
packages/atomic-elements/package.json Version bump to 3.6.0
packages/atomic-elements/CHANGELOG.md Added 3.6.0 release notes
packages/forms/package.json Updated atomic-elements dependency to ^3.6.0 and version bump to 3.6.0
packages/forms/CHANGELOG.md Documented version update (though labeled as 4.0.0)
CLAUDE.md Added comprehensive repository documentation for Claude Code

@seanrcollings seanrcollings merged commit 266168b into main Dec 18, 2025
1 check passed
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