Repository navigation
feat(react): port the fiber renderer's reconciler, shared and types - #11182
chrisgervang wants to merge 9 commits into
Conversation
Copy src/reconciler, src/shared and src/types from deck.gl-community modules/react-fiber at ce43fd6d, with their tests. Nothing is exported yet. The code began as Brandon Pierce's Deck.gl Fiber Renderer (@deckgl-fiber-renderer/dom 2.0.1); adapted files carry its copyright line, and modules/react/LICENSE lists both copyright holders. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
[Medium impact] The latest changes appear safe to merge. SummaryAdds the internal React Fiber renderer without changing public exports. The latest update finishes the React tree’s unmount before finalizing Deck.
Reviews (9) · Last reviewed commit: "fix(react): finish the unmount before fi..." · Reviewed by Greptile |
…rnals - Mark the hidden copy React makes for a re-suspended Suspense boundary and skip it when collecting nodes, so only the fallback reaches deck.gl. - Fall back to the current event's priority in resolveUpdatePriority, which react-reconciler 0.33 calls instead of getCurrentEventPriority. - Add TSDoc to the undocumented internal declarations. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
…r-safe - Add TSDoc to interface fields and error-boundary members. - Move DevTools registration into registerWithDevTools(), called when the module loads. The headless project shares modules across test files, so a fresh import didn't re-run the registration once another file had loaded the renderer; the test now calls the function directly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Two renderer tests configured a standalone root, which creates a Deck with its own WebGL context. Both contexts outlived the test, and in the headless project, which shares one page, Chromium then dropped the oldest context: the shared test device, so every later GPU test failed with "WebGL context is lost". Passing the shared device creates no context. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
…ernals # Conflicts: # modules/react/package.json # package.json
ibgreen
left a comment
There was a problem hiding this comment.
This commit adds [email protected] as a production dependency while @deck.gl/react still advertises React >=16.3.0. In a React 18.3.1 consumer fixture with these dependency declarations, npm install warned about the peer override and npm ls react exited ELSPROBLEMS because the reconciler requires React ^19.2.0. Since this PR only adds internals, could you keep react-reconciler in devDependencies here and promote it to dependencies in #11183 alongside the peer bump? That keeps each published commit installable for its advertised peers.
… ships This PR only adds internals, and `@deck.gl/react` still accepts React >=16.3, while [email protected] requires React ^19.2. As a dependency it made the published package fail to install cleanly for React 18 apps. It moves to `dependencies` in #11183, together with the React ^19.2 peers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
|
Done in e3b2fc1: Generated by Claude Code |
ibgreen
left a comment
There was a problem hiding this comment.
Verified the dependency sequencing fix at e3b2fc1 with fresh packed consumers: npm install --ignore-scripts --strict-peer-deps now succeeds on React 18.3.1 and 19.2.0, and npm ls react --all exits successfully for both. The reconciler is no longer installed as a runtime dependency. CJS and ESM root/legacy imports load and preserve matching export identities on both versions.
I also checked #11183 at 4458288: it promotes the reconciler to a runtime dependency alongside the ^19.2.0 React/React DOM peers, so the package metadata now expresses the intended release sequence. This closes the installability concern raised above.
Scope: focused module emission with noCheck and the repository transforms, actual CJS build helper, packed consumers with real registry dependencies. Not a full local build/browser verification; current-head hosted CI was still running when checked.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 23489c9. Configure here.
`unmountAtNode` scheduled the unmount with `updateContainer` and finalized Deck at once. On a concurrent root the unmount only commits later, so the tree's layout and passive effect cleanups ran after Deck was finalized and the store's `deckgl` was cleared. It now commits the unmount with `updateContainerSync` and `flushSyncWork` first. A test records the order of the cleanups and finalize. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
|
Superseded by #11245, #11246 and #11247, per the updated plan in #11036:
The WebGL context release from #11183 is its own work stream in #11221. The review threads here stay as the record of the changes in #11246. Generated by Claude Code |
…sgl#11246) * feat(react): copy the fiber renderer from deck.gl-community Copies `modules/react-fiber/src` from visgl/deck.gl-community at 090b2439 (v10.0.0-alpha.3) byte for byte. Source files keep their path under `modules/react/src`. Tests move out of `src/**/__tests__` into `test/modules/react/fiber`, keeping their names except that browser tests (`*.browser.test.tsx`) and the reconciler and shared tests become `*.spec.*` files for the headless project. This commit does not build on its own: the next commit makes the mechanical edits (license headers, the package name and import paths), and the one after switches the package root. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * chore(react): make the copied renderer's mechanical edits No behavior changes: - Each copied file gets the deck.gl license header with the Deckgl Fiber Renderer copyright line, as agreed in visgl#11036. - `@deck.gl-community/react-fiber` becomes `@deck.gl/react`, in doc comments, `RENDERER_PACKAGE_NAME` and the DevTools test. - Test imports of the module (`../config`, `../../dom/mapbox`, ...) now name `@deck.gl/react/<path>`, and imports of test helpers point at their new location. The entry points test reads `modules/react/package.json`, and the tree-shaking test bundles from `modules/react/src/wrappers`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * style(react): format the two tests whose import paths grew Biome, after the previous commit lengthened their import paths. No other change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * feat(react)!: make the copied renderer the @deck.gl/react root BREAKING CHANGE: `@deck.gl/react` now exports the React Fiber renderer. The previous API stays available at `@deck.gl/react/legacy`. The packaging follows visgl#11036: - `package.json` exports the renderer's subpaths (`/mapbox`, `/maplibre`, `/google-maps`, `/core`, `/layers`, `/geo-layers`, `/aggregation-layers`, `/mesh-layers`, `/widgets`, `/reconciler`) next to `/legacy`, with `react-reconciler`, `its-fine` and `client-only` as dependencies and React `^19.2.0` peers. `build-cjs.mjs` already shares any entry, so it needs no change. - `LICENSE` and the README credit the Deck.gl Fiber Renderer. - A `react` vitest project runs the jsdom unit and type tests, with the `clearMocks` and `reportError` setup the deck.gl-community config used. The headless project also runs `*.spec.tsx`. - The legacy tests import `@deck.gl/react/legacy`, and the test that the root re-exported `/legacy` is removed. - The website, which runs React 18, resolves the bare root to `/legacy`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * test(react): skip four copied tests until the follow-up adapts them Each one checks something that differs in deck.gl, not in the copied code: - entrypoints: deck.gl's package also exports `./legacy` and requires `@deck.gl/widgets` for it. - wrappers: deck.gl master added `_ColorScaleWidget`, which has no wrapper yet. - devtools: the headless project shares one page, so an earlier file has already loaded the renderer when this test imports it. - utils: "false in Node.js" runs in Chromium in the headless project. Each skip has a comment saying why. The follow-up PR re-enables them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * fix(react): apply the deck.gl review of the copied renderer The changes made while visgl#11182 and visgl#11183 were reviewed, on top of the copy: - Re-suspended content is hidden: `cloneHiddenInstance` marks its copy, and the tree flattening skips hidden instances (Greptile on visgl#11182). - Updates without an explicit priority use the live event priority, so a click is discrete (Greptile on visgl#11182). - `unmountAtNode` commits the unmount before it finalizes Deck, so effect cleanups still see it (Bugbot on visgl#11182). - The DOM root imports the reconciler, and the map roots the root component, through their entries, so each CommonJS bundle requires one copy of the renderer instead of inlining it (Ib on visgl#11183). `/reconciler` exports the error boundary as `_RootErrorBoundary` for that. - `_ColorScaleWidget`, added to `@deck.gl/widgets` on master, gets a wrapper. - DevTools registration is a function, `registerWithDevTools`, so a test can call it in the headless project's shared page. - TSDoc on the internal declarations (Greptile on visgl#11182). Tests: the four tests the copy skipped are adapted and re-enabled; new tests cover each fix above, the CommonJS entries and the peer versions. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * fix(react): finish unmounting when an app callback throws during teardown From Greptile's review of visgl#11245: - The DOM root's layout cleanup detaches the overlay and calls `onDeckChange(null)` first. If either throws (an `onDeckChange`, a ref cleanup or a custom detach), the cleanup now still clears the overlay and unmounts the root, so Deck does not keep running. A test throws from `onDeckChange(null)` and checks the root is unmounted; it fails without the change. - Each wrapper component in `/core`, `/layers`, `/geo-layers`, `/aggregation-layers`, `/mesh-layers` and `/widgets` gets a one-line TSDoc comment, as `AGENTS.md` asks. - `flattenTree` and `organizeList` name their variables (`roots`, `instance`, `descriptors`, `node`) instead of `arr`, `val`, `acc` and `curr`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * test(react): run the renderer's specs outside headless until visgl#11221 Finalized Decks don't release their WebGL context yet. In the shared headless page, master's specs leave 14 contexts open, two short of Chromium's limit; the renderer's specs add more and reach it, and the test device is then lost for every later file (266 failures in CI on visgl#11245). Until visgl#11221 releases those contexts, the headless project excludes `test/modules/react/fiber/**/*.spec.*`, so it runs the same files as master; they still run in the `browser` project. The renderer's jsdom tests still run in the `react` project. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * chore(react): credit the Deckgl Fiber Renderer only on files adapted from it visgl#11245 added the "Deckgl Fiber Renderer contributors" copyright line to every copied file. visgl#11036 puts it only on files adapted from the Deck.gl Fiber Renderer at 9e348b6. These 48 files were written later in deck.gl-community and have no counterpart there (the map roots, `deck-canvas`, `attach-*`, the error boundary, the shared hooks, the wrappers and their tests), so the line is removed. Files adapted from the renderer keep it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * test(react): check that re-suspended content comes back once it resolves The Suspense test stopped once the fallback showed, with a promise that never resolved, so it would pass even if hidden content never returned. It now resolves the promise and checks that the content is back and the fallback gone (Greptile on visgl#11246). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * style(react): make the CommonJS import comments inline The DOM root and the three map roots explained, in a comment above the import, why they import through an entry file. Each is now a short comment on the import line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * style(react): drop the comments on the map roots' entry imports Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * ci: run the React renderer's browser specs in their own job until visgl#11221 The renderer's `*.spec.*` files are excluded from the shared headless page until visgl#11221 releases WebGL contexts, so neither `test-coverage` nor `test-webgpu` runs them. A new `test-react-renderer` job runs them in the `browser` project under Xvfb, in a Chromium of their own (Ib on visgl#11246). Locally: 21 files, 224 tests pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * test(react): check isBrowserEnvironment in Node.js and jsdom again fiber.gl covered both environments: `utils.test.ts` ran in Node.js and checked `isBrowserEnvironment` is false, `utils-browser.test.ts` ran in jsdom and checked it is true. As `*.spec.ts` files they ran in the headless Chromium, which ignores `@vitest-environment`, so the Node.js check had become a second browser check. Both are `*.test.ts` files in the `react` project again, with their environment docblocks, as `dom/ssr.test.ts` already is. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * style(react): drop the comment on the DOM root's reconciler import `cjs-entries.node.spec.ts` already fails if the import stops going through the `/reconciler` entry, so the comment is not needed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn --------- Co-authored-by: Claude <[email protected]>

For #11036
Background
First step of moving the React Fiber renderer into
@deck.gl/react. This copies the internal layers from deck.gl-communitymodules/react-fiberat ce43fd6d, with their tests. Nothing is exported yet; the root, components and map roots follow in separate PRs.The code began as Brandon Pierce's Deck.gl Fiber Renderer (
@deckgl-fiber-renderer/dom2.0.1, MIT). Files adapted from it carry its copyright line, andmodules/react/LICENSElists both copyright holders.Change List
modules/react/src/reconciler: host config, renderer and error boundarySuspensefallbackresolveUpdatePriorityfalls back to the current event's prioritymodules/react/src/shared: store, constants and helpersmodules/react/src/types: JSX and React prop typesmodules/react/LICENSEwith both copyright linesreact-reconcilerdependencyheadlessprojectVerified with
yarn lint, theheadlesstests fortest/modules/react(223 passed), and atspcbuild of the module.Note
Low Risk
Low risk as this PR introduces internal reconciler modules, types, and unit tests without altering existing public APIs or runtime code paths.
Overview
Introduces the internal React Fiber custom reconciler and supporting infrastructure into
@deck.gl/react. This lays the foundation for native React concurrent rendering by implementing a persistent host config (react-reconciler), root lifecycle management (createRoot,unmountAtNode), and intrinsic JSX element definitions (deckLayer,deckView,deckWidget, anddeckEffect).Adds internal state management, custom hooks, and tree-flattening utilities to coordinate declarative JSX descriptors with underlying
Deckinstances. Also introduces comprehensive test suites covering reconciler host configuration, event handling, DevTools integration, and lifecycle behavior, along with requiredreact-reconcilerdependencies and dual-copyright licensing.Reviewed by Cursor Bugbot for commit 530092a. Bugbot is set up for automated code reviews on this repo. Configure here.