Skip to content

feat: lightweight react-reconciler-compatible reconciler - #107

Open
aidenybai wants to merge 4 commits into
mainfrom
devin/1787903202-lightweight-reconciler-nil
Open

feat: lightweight react-reconciler-compatible reconciler#107
aidenybai wants to merge 4 commits into
mainfrom
devin/1787903202-lightweight-reconciler-nil

Conversation

@aidenybai

@aidenybai aidenybai commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds bippy/reconciler: a compact react-reconciler-compatible reconciler (~13.7 kB ESM / 5.2 kB gzip vs react-reconciler's ~398 kB min / 65 kB gzip), inspired by Cody Bennett's react-nylon.

import { createReconciler } from "bippy/reconciler";

const reconciler = createReconciler(hostConfig); // same host-config shape as react-reconciler
const root = reconciler.createContainer(container);
reconciler.updateContainer(<App />, root);
  • Own tiny fiber tree that satisfies bippy's isFiber, plus DevTools-hook injection (getRDTHook().inject + onCommitFiberRoot), so bippy instrument() observes custom renderers built on it.
  • React 19 dispatcher interop (__CLIENT_INTERNALS... with legacy __SECRET_INTERNALS... fallback) with a broad hook dispatcher (useState/useReducer/useEffect/useLayoutEffect/useInsertionEffect/useContext/useSyncExternalStore/useTransition/useOptimistic/use/...).
  • Supports function/class components, keyed reconciliation, iterables/fragments, refs (attach/detach/swap), context (provider + Context.Consumer render props), portals, error boundaries, basic thenable/Suspense handling, flushSync/act.
  • Class lifecycles: componentDidMount / componentDidUpdate / componentWillUnmount (including for class components nested inside host instances — deletion now walks the whole subtree for effect cleanup/lifecycles via commitDeletionEffects, separate from host-node removal).
  • React 19 ref-as-prop compat: refs are read from props.ref (never the deprecated warning element.ref getter) and stripped from host props.

Compatibility

Not 1:1 with React's reconciler — lanes/priorities, hydration, and host context are intentionally omitted to stay tiny. Representative tests ported from react-reconciler's suite (ReactFragment, ReactFiberRefs, class components/setState callback/lifecycles, ReactHooksWithNoopRenderer, ReactNewContext, ReactFlushSync, ReactIncrementalSideEffects, ReactMemo) run against a noop host config in tests/react-reconciler-compat.test.tsx — all pass. Porting them surfaced and fixed real gaps:

  • stale dispatch: updater functions captured on mount now resolve state from queue.lastRenderedState instead of a stale fiber's memoizedState
  • context value updates were dropped on re-render (_context lost in updateElement)
  • Context.Consumer element types were collapsed to their $$typeof symbol and never rendered
  • ref swaps (ref={ref1}ref={ref2}) now detach the old ref, and refs only re-attach when changed (callback refs no longer re-fire every commit)

Testing

  • pnpm --filter bippy test: 629 passed, 2 skipped
  • pnpm check, tsc --noEmit, pnpm --filter bippy build all green

Link to Devin session: https://app.devin.ai/sessions/0965b0b326de4f2fa5da504f2d60cd55
Open in Devin Desktop: https://app.devin.ai/desktop/session/0965b0b326de4f2fa5da504f2d60cd55?variant=devin
Requested by: @aidenybai

…l clone

Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from Aiden Bai

in bippy, create a lighter weight version of react-reconciler but w full compat. cody j barret had something similar fo rthis

then impl a react-nil clone but interare and super lgithweigth. then PR

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5d74d60

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bippy Ready Ready Preview Aug 28, 2026 8:57am

@pkg-pr-new

pkg-pr-new Bot commented Aug 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/bippy@107

commit: 5d74d60

Comment thread packages/bippy/src/reconciler/commit.ts Outdated
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
@devin-ai-integration devin-ai-integration Bot changed the title feat: lightweight react-reconciler-compatible reconciler + react-nil clone feat: lightweight react-reconciler-compatible reconciler Aug 28, 2026
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.

1 participant