Agent Skills fixes its React error boundary, which crashed even with healthy children

1 month ago

Agent Skills' shipping-and-launch skill taught a React error boundary that crashed on every render and never showed its fallback. Pull request 637, merged October 10, 2026, initializes its state and adds getDerivedStateFromError. It is on main, after the 0.6.12 release. https://github.com/addyosmani/agent-skills/pull/637 https://github.com/addyosmani/agent-skills/blob/main/skills/shipping-and-launch/SKILL.md https://github.com/addyosmani/agent-skills

Ask about this presentation

Chapters

  1. 0:00Agent Skills fixes its React error boundary, which crashed even with healthy children
  2. 0:18The boundary read its state before setting any
  3. 0:32It could report an error but never switch to the fallback
  4. 0:48Six added lines set a starting state and add the missing lifecycle
  5. 1:04With React 19.2, all three checks pass
  6. 1:19Strict TypeScript still flags the sample's props
  7. 1:36Check any error boundary your agent copied from the shipping skill
Show transcript
  1. Addy Osmani's Agent Skills teaches your coding agent a React error boundary, inside its shipping and launch skill. That sample threw on every render, even when every component inside it was healthy. A fix merged on October 10 makes the boundary render its fallback screen.

    Slide text
    github.com/addyosmani/agent-skills merged Oct 10, 2026
    throws on every render fallback renders
    shipping-and-launch skill · PR #637
  2. The render method checks this.state.hasError, but the class never gives state a starting value. So state is null, and the boundary crashes with a type error on its first render, before any child has done anything wrong.

    Slide text
    shipping-and-launch · Error Reporting before
    class ErrorBoundary extends React.Component {
      componentDidCatch(error, info) { reportError(…) }
    
      render() {
        if (this.state.hasError) {
          return <ErrorFallback onRetry={…} />;
        }
        return this.props.children;
      }
    }
    TypeError: Cannot read properties of null (reading ‘hasError’)
    PR #637 · skills/shipping-and-launch/SKILL.md
  3. The sample had componentDidCatch, which sends the error to a tracking service. It had no getDerivedStateFromError, the lifecycle method that flips hasError to true. Without it, a crashing child gets reported, and the fallback screen stays hidden.

    Slide text
    shipping-and-launch · Error Reporting before
    ✓ componentDidCatch sends the error to tracking
    ✗ getDerivedStateFromError missing, so hasError never turns true
    PR #637 · skills/shipping-and-launch/SKILL.md
  4. The fix gives state a starting value of hasError false, and adds a static getDerivedStateFromError that returns hasError true when a child throws. The error report, with its component stack, user and page, stays as it was, and so does the retry button.

    Slide text
    shipping-and-launch · Error Reporting after
    class ErrorBoundary extends React.Component {
      state = { hasError: false };
    
      static getDerivedStateFromError() {
        return { hasError: true };
      }
    
      componentDidCatch(error, info) { reportError(…) }
      render() { … unchanged … }
    }
    PR #637 · commit a31135a2
  5. With React 19.2, a healthy child now renders with zero error reports. A failing child shows the fallback and reports the original error. And pressing retry once the child recovers brings it back without a second report.

    Slide text
    React 19.2 · ReactDOM 19.2 · jsdom after
    ✓ Healthy child renders · zero error reports
    ✓ Failing child fallback shows · error, stack, user, page reported
    ✓ Retry after recovery child renders again · no new report
    PR #637 · reproduction
  6. The class still extends an untyped React Component, so strict TypeScript flags this.props.children. Typing the props is left for a follow-up. The three checks ran in jsdom, a simulated browser DOM, so a real browser engine hasn't run them.

    Slide text
    shipping-and-launch · Error Reporting still open

    Strict TypeScript still flags the sample’s props

    ✗ this.props.children untyped React.Component · follow-up
    ✗ jsdom only a DOM runtime check · no browser engine
    PR #637 · review by addyosmani
  7. The fix is on the main branch of the agent-skills plugin for Claude Code and Codex, newer than the October 3 release. If your agent built an error boundary from the shipping and launch skill, compare it with pull request 637.

    Slide text
    github.com/addyosmani/agent-skills merged Oct 10, 2026
    plugin agent-skills · Claude Code and Codex
    where main, after the Oct 3 release
    source github.com/addyosmani/agent-skills/pull/637
    PR #637 · .claude-plugin · .codex-plugin

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York