Skip to content

feat: publish react-error-boundary under the systemfsoftware scope - #1

Open
systemfsoftware-bot wants to merge 9 commits into
mainfrom
bring-under-systemfsoftware-standard
Open

systemfsoftware-bot wants to merge 9 commits into
mainfrom
bring-under-systemfsoftware-standard

Conversation

@systemfsoftware-bot

@systemfsoftware-bot systemfsoftware-bot commented Nov 29, 2026 •

Copy link
Copy Markdown

What this is

@systemfsoftware/react-error-boundary is the react-error-boundary 6.1.6 library, published under the systemfsoftware scope. It is a port of that library, not a re-export and not a rewrite. The exports in src/index.ts are unchanged.

How it differs from upstream, and why

  • The package is built and checked with the frontend standard: a pnpm workspace, a tsdown ESM and CJS build, dprint, oxlint on the frontend preset, changesets, and the shared CI workflows.
  • import.meta.env.DEV is defined as false in the published build, which is what the upstream 6.1.6 build shipped. The "use client" directive is kept.
  • withErrorBoundary is typed as <Props extends object, Type extends ComponentType<Props>>(Component: Type & ComponentType<Props>, …). The wrapped component's props and ref type are preserved, including class defaultProps, and a test-types/ assertion proves the data-last call keeps them. Upstream widened the component to ComponentType<any>.
  • A resetKeys change resets in componentDidUpdate as upstream does: onReset is called first, then the boundary state is cleared, so a caller that clears its failed state in onReset has the children retry with that state in place. The rule that flags a setState in componentDidUpdate is suppressed on that one line with its reason.
  • useErrorBoundary returns the exported UseErrorBoundaryApi, and its resetBoundary forwards its arguments to onReset, as the fallback's resetErrorBoundary does.
  • withErrorBoundary renders the wrapped component with createElement and names memoized and forwarded components in displayName.
  • withErrorBoundary and hasArrayChanged carry a pipeable overload (withErrorBoundary(props)(Component), hasArrayChanged(next)(prev)); the two-argument calls are unchanged.
  • Behaviour is covered by Storybook scenarios run in a real browser with Vitest, not jsdom. hasArrayChanged has an in-source property test. There is no *.test.tsx lane.

Checks run locally

  • pnpm lint (frontend preset, type-aware): pass. Two per-line suppressions carry their reasons: react/no-did-update-set-state on the reset setState, and typescript/consistent-type-assertions on the child props that createElement takes, which upstream casts the same way. No file-wide overrides.
  • pnpm typecheck: pass, including the tstyche assertion in test-types/
  • pnpm build: pass
  • dprint check: pass
  • pnpm test with a real Chromium: 6 files, 37 tests passed, including the reset-key ordering, exactly-once reporting under StrictMode, and the arguments the hook reset forwards
  • A throwaway jsdom harness reproduced the ordering defect on the previous head (a key change reported onReset only after the children had retried and thrown again, and the hook reset dropped its arguments) and passed after the change; it was deleted.

CI in .github/workflows/ci.yml (pnpm format:check, pnpm lint, pnpm typecheck, pnpm build, attw --pack ., publint, pnpm test including the storybook browser lane, and the changeset check) and squash-message.yml are pending on this pull request head ddda2e4.

The library moves to packages/react-error-boundary as @systemfsoftware/react-error-boundary. Its source, tests and public
API are the react-error-boundary 6.1.6 code. The docs site, the eslint, prettier and husky setup, and the Vite
configuration are removed.

- pnpm workspace with dprint, oxlint (recommended and frontend configs), commitlint and changesets
- CI, release, merge-queue and squash-message workflows from the shared systemfsoftware workflows
- the build is tsdown (ESM and CJS); tsdown defines import.meta.env.DEV as false, as the upstream build did
- tests keep the upstream vitest imports and names; see packages/react-error-boundary/oxlint.config.ts for the reasons
@mergify

mergify Bot commented Nov 29, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

systemfsoftware-bot and others added 8 commits November 29, 2026 00:54
Lint runs on the frontend config alone. Thrown values are narrowed through
type guards, branching is split into small functions, handlers are arrow
properties, and the HOC is typed without casts. Tests move to tests/, import
the package by name, and use DAMP names and the wrapper's checks. The dprint
exclusion is removed.
Extract hasArrayChanged so its comparison can carry an in-source property test.
Type withErrorBoundary without any, and add the Storybook and browser Vitest dependencies the scenarios will run under.
Replace the jsdom tests with storybook-gherkin scenarios, including the class ref and defaultProps cases.
Keep an in-source property test for hasArrayChanged, and type withErrorBoundary so the wrapped component props and ref are preserved.
…render

The boundary now derives its reset in getDerivedStateFromProps from the reset keys it recorded
when the error was caught, so a key change that is itself what triggered the error records the
new keys without resetting. onReset for a key reset moves to getSnapshotBeforeUpdate so callers
are told while the failing fallback is still in the DOM; componentDidUpdate stays as its React-
required pair. Public behavior and the browser stories are unchanged.
- The storybook project runs in real Chromium, so the test job fetches the build the lockfile's playwright version names, with the system libraries headless Chromium needs.
- Only a push to main writes the browser cache, as with the pnpm store.
- `resetKeys` resets now run in `componentDidUpdate`: `onReset` is called, then the boundary state is cleared, so a caller that clears its failed state in `onReset` has the children retry with that state already in place. The one `react/no-did-update-set-state` line is suppressed with its reason.
- `useErrorBoundary().resetBoundary` forwards its arguments to `onReset` and returns the exported `UseErrorBoundaryApi` type.
- `withErrorBoundary` renders the wrapped component with `createElement` and names memoized and forwarded components in `displayName`. The data-last overload keeps the component props, proved by a tstyche test that `typecheck` now runs.
- Browser scenarios cover the upstream reset order, reporting exactly once under `StrictMode`, and the arguments the hook reset forwards; a changeset records the fix.
- A tstyche type test asserts that `withErrorBoundary(props)(Component)` still refuses a missing required prop, for a component type, a function, a forwarded and a memoized component.
- `typecheck` runs tstyche after `tsc`, so the assertion gates the build.
…properties

- Replace the single-valued absent pair with one property over absent-or-empty on both sides, covering each side separately.
- Draw the sign property from {0, -0} plus finite numbers, covering negative, zero and opposite-zero draws.
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.

2 participants