Skip to content

feat(react)!: make the fiber renderer the @deck.gl/react root - #11183

Closed
chrisgervang wants to merge 36 commits into
chr/react-fiber-internalsfrom
chr/react-fiber-root
Closed

chrisgervang wants to merge 36 commits into
chr/react-fiber-internalsfrom
chr/react-fiber-root

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

For #11036

Background

Stacked on #11182, with #11181 merged in. This PR's own change is the last commit. It copies src/dom and src/wrappers from deck.gl-community modules/react-fiber at ce43fd6d and makes the renderer the package root. The previous API stays at @deck.gl/react/legacy. Docs, the upgrade guide (#11037) and examples follow.

Change List

Verified with yarn lint, the react project (390 tests, no type errors), the node project, the full headless project with no test setup patch (312 files pass, no lost contexts). CI runs the module build.


Generated by Claude Code

Move the module's sources under src/legacy and re-export them from the
package root, and add a ./legacy subpath export. The root API is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
The build adds a .js extension to relative imports, so './legacy' became
'./legacy.js', which doesn't exist because legacy is a directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Copy src/dom and src/wrappers from deck.gl-community modules/react-fiber at
ce43fd6d, with their tests and type tests, and export them:
- `.`: DeckGL, createDeckGL, DeckCanvas and the create*Component factories
- `/mapbox`, `/maplibre`, `/google-maps`: provider-bound roots
- `/core`, `/layers`, `/geo-layers`, `/aggregation-layers`, `/mesh-layers`,
  `/widgets`: components for the built-in classes
- `/reconciler`: the advanced entry

The previous API stays at `/legacy`. The deck.gl package, examples, test apps
and website now import it from there. React and react-dom peers move to
>=19; the layer, map and other deck.gl modules become optional peers.

Tests: a `react` vitest project runs the renderer's jsdom unit tests and type
tests, isolated per file because they mock modules; its browser tests run in
`headless`. Adds @testing-library/react, @testing-library/dom and mapbox-gl 3
(interleaved Mapbox tests need v2+) as dev dependencies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
…wser tests

Each DeckGL root and map in the renderer's browser tests creates its own
WebGL context, and finalizing or removing it does not release the context.
Across the headless project's shared page this left about 15 contexts alive,
past Chromium's limit, which then dropped the shared test device. A helper
loses the contexts a test created after the test unmounts its roots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Vite found react/jsx-dev-runtime mid-run in CI and reloaded the headless
page, after which most test files failed with "Vitest failed to find the
current suite". Add the renderer's browser-test dependencies to
optimizeDeps.include, like the existing Preact and luma.gl entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
The headless and browser projects run every file in one page. Deck and map
instances keep their WebGL contexts after they are finalized, so contexts that
files leave behind add up. With the React renderer's specs added, the page went
over Chromium's context limit during the interleaved map tests, Chromium dropped
the shared test device, and every later GPU test failed with "WebGL context is
lost".

A new setup file records the WebGL contexts each file creates and loses them in
afterAll, keeping the shared synchronous test device. The React DOM specs keep
releasing after every test, since they mount several roots per file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
@coveralls

coveralls commented Nov 18, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 82.918% — chr/react-fiber-root into chr/react-fiber-internals. No base build found for chr/react-fiber-internals.

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The advertised React minimum does not match the reconciler dependency. At d011055, modules/react/package.json accepts React/React DOM >=19.0.0, but pinned [email protected] declares react: ^19.2.0. I reproduced clean npm ERESOLVE failures with both React 19.0.0 and 19.1.0 plus this reconciler (without force/legacy-peer-deps).

Please align the React/React DOM peer minimum and upgrade guidance with 19.2, or use a reconciler strategy compatible with the intended earlier React versions. Add a clean consumer-install check at the declared minimum so workspace hoisting cannot hide this. This is a verified installation conflict, not a demonstrated runtime failure.

ocular's build-cjs bundles each `require` entry separately with only packages
external, so `dist/index.cjs` inlined its own copy of `/legacy`, with its own
DeckGL context. A component calling `useWidget` from one entry could not see a
`DeckGL` from the other.

The root now re-exports `@deck.gl/react/legacy` by package name, so its CJS
bundle is a `require` of the legacy bundle. The default export is re-exported by
name, because the CJS interop would otherwise make `default` the whole
`module.exports` object. A node test bundles both entries with the build-cjs
settings and checks the root requires `/legacy` and shares its identities.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
…hr/react-fiber-root

# Conflicts:
#	modules/react/src/index.ts
ocular's build-cjs bundles every `require` entry separately with only packages
external, so the root, the three map roots and `/reconciler` each inlined their
own reconciler: their own `roots` map, DevTools registration and
`RootErrorBoundary` class, which the renderer recognizes by `instanceof`.

The DOM root now imports the reconciler, and the map roots import
`createDeckGL`, by package name, so their CJS bundles require the entry that
owns that code. `/reconciler` exports the error boundary as an internal
`_RootErrorBoundary` for the DOM root. A node test bundles every CJS entry with
the build-cjs settings and fails if a module other than a few stateless helpers
is inlined by more than one entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Importing `@deck.gl/react/legacy` by package name left that specifier in
`dist/index.js` and `dist/index.d.ts`, which TypeScript with
`moduleResolution: node` and bundlers that ignore `exports` can't resolve.

The root imports `./legacy/index` again. A module build script, run after
ocular-build like CARTO's, rebuilds the CommonJS entries so that an import of
another entry's file becomes a relative `require` of that entry's bundle:
`dist/index.cjs` is `require("./legacy/index.cjs")`. The node test bundles the
entries with the script's own options and checks the root has no relative
package import.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
`[email protected]` peers on `react ^19.2.0`, so the `>=19.0.0` peers let
npm fail with ERESOLVE for apps on React 19.0 or 19.1. The React and React DOM
peers are now `^19.2.0`.

A node test reads each dependency's installed manifest and checks that the React
peer ranges are a subset of the range it declares, so a workspace install that
hoists one React can't hide a mismatch. `semver` and `esbuild`, which the React
tests use, are now root dev dependencies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
…cjs.mjs

Takes #11181's module build script and goes back to relative imports: the DOM
root imports `../reconciler/index` and the map roots `../index`, which the
script turns into requires of `./reconciler/index.cjs` and `../index.cjs`, so
no published file imports `@deck.gl/react` by package name. The root keeps the
renderer, so #11181's root-to-legacy test doesn't apply; the entries test now
bundles with the script's options and also checks the source has no
package-name self imports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

Copy link
Copy Markdown
Collaborator Author

Thanks, confirmed. Fixed in b13c69a: the React and React DOM peers are now ^19.2.0, matching [email protected].

For the install check, test/modules/react/fiber/peer-versions.node.spec.ts reads each dependency's installed manifest and fails unless our React peer ranges are a subset of the range it declares (and the installed version satisfies our dependency range), so a hoisted workspace React can't hide a mismatch. It fails on the old >=19.0.0 peers. It doesn't run npm install against the registry; I can add a packed-tarball install job if you'd prefer that.

Also in this push (95a292d): the CommonJS entries now share the reconciler and the root component through build-cjs.mjs from #11181, instead of each inlining a copy, with cjs-entries.node.spec.ts covering it.


Generated by Claude Code

ibgreen commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Retested at 3593670: the React peer-range finding is addressed. A clean consumer install of the packed current package manifest with exact React/React DOM 19.2.0 now succeeds without --force or --legacy-peer-deps; npm ls confirms one deduped React 19.2.0 with [email protected].

The new peer-range test and both CJS-entry tests also pass independently. Source-generated CJS bundles using the package's build helper load the root, /legacy, and /reconciler successfully with real installed dependencies. This was focused install/entry-point verification, not a full package declaration build or browser/map integration pass. Current-head CI is green.

TypeScript's `node` resolution ignores `exports`, so `@deck.gl/react/legacy`
failed with TS2307 for apps still on it. `typesVersions` now maps `legacy` to
`dist/legacy/index.d.ts`. A node test checks that every `exports` subpath has a
`typesVersions` entry for the same declarations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Takes #11181's `typesVersions` fix and its test, and maps every renderer subpath
(`/mapbox`, `/maplibre`, `/google-maps`, the component subpaths and
`/reconciler`), so they resolve under `moduleResolution: node` too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
… test patch

Takes the core fix from #11221 (cherry-picked): `finalize()` releases a device
on a canvas Deck created, and `_releaseCanvasContext` releases one on a canvas
the app passed once it leaves the document. The legacy `DeckGL` already calls
it; the renderer's DeckGL root now does too when it unmounts a canvas root.
Map overlays render to Deck's own canvas or the map's context, so they need
nothing extra.

With contexts released at the source, the browser test setup file and the
React specs' per-test helper that patched `getContext` are removed. See #11220.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
- A Deck given another Deck's `device` or `gl` now counts the canvas it renders
  to, so finalizing the first Deck can't lose a context the second still uses.
- `finalize()` uncounts the canvas once, so finalizing a Deck twice can't drop
  the count of another Deck on the same canvas.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
When a release is skipped because another Deck still renders to the canvas
(for example one that was passed the device), it now waits on the canvas and
completes when that Deck is finalized, instead of leaving the context to
garbage collection. A passed canvas is checked again for being out of the
document at that point.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The new context-release cleanup also runs for a caller-owned canvas prop. In dom/components.tsx, !isExternalOverlay distinguishes standalone Deck from map overlays, but does not distinguish the canvas React rendered from config.canvas supplied by the app. If the app detaches its canvas while unmounting this component, the scheduled cleanup loses its device, preventing later reuse of that same canvas. The helper explicitly warns against calling it for canvases that may be reused after leaving the document.

I reproduced the release decision using the actual component and release helper with a mocked reconciler/device: unmounting with a detached external canvas calls loseDevice; keeping that canvas connected does not. This is a focused lifecycle test, not a browser WebGL remount test.

Please restrict automatic release to the React-owned canvas (!config.canvas, captured for this cleanup), leaving externally supplied canvases under application control, and add a detached external-canvas/unmount/remount regression test.

The root released the context on unmount for any canvas root, including a
canvas the app passed as `canvas`. An app that detached its own canvas while
unmounting could not reuse it: the next DeckGL on it got the lost context. The
root now releases only the <canvas> it rendered, and leaves an app's canvas
under the app's control. A test detaches an app canvas, unmounts, and remounts
a new DeckGL on it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

Copy link
Copy Markdown
Collaborator Author

Thanks, confirmed and fixed in 8565a67. The root now captures ownsCanvas = !isExternalOverlay && !config.canvas when its layout effect runs, and only releases on unmount when it rendered the <canvas> itself; a canvas passed as canvas stays under the app's control.

New test in test/modules/react/fiber/dom/release-context.spec.tsx: render with an app canvas, detach it while unmounting, check the context isn't lost, then re-attach it and mount a new DeckGL on the same canvas. It fails on fe2d665 and passes now. The legacy DeckGL always renders its own canvas (its canvas prop is overridden by the rendered one), so it doesn't have this case.


Generated by Claude Code

ibgreen commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Verified the ownership fix at 8565a6739: my original detached caller-canvas repro now preserves the device. Four focused actual-component/helper checks pass: detached external canvas, connected external canvas, React-owned canvas release, and switching from an owned canvas to a caller canvas (only the old owned canvas is released).

This addresses my review finding. My tests use a mocked reconciler/device, not a real WebGL remount; the exact-head hosted test workflow is also green.

# Conflicts:
#	modules/react/package.json
#	modules/react/src/index.ts
#	test/modules/react/legacy.spec.ts
#	test/modules/react/use-widget.spec.ts

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This head includes the context teardown from #11221. In _createDevice, the ownership test treats a supplied HTML canvas from another window as owned because it fails instanceof HTMLCanvasElement in the current realm. Finalizing the renderer can then lose an application-owned WebGL context. Could you split that teardown out of the Fiber switch, or track ownership at canvas creation and cover reuse of an iframe-supplied canvas? The device ownership alternative is in visgl/luma.gl#3791.

chrisgervang pushed a commit that referenced this pull request Nov 19, 2026
… 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
`ownsCanvas` used `instanceof HTMLCanvasElement`, so a canvas from another
window (an iframe) counted as Deck's own and finalize() could lose an app's
context. Deck now owns a canvas only when it created it: its own <canvas>, or
the OffscreenCanvas of multi-canvas mode. A test passes an iframe canvas,
finalizes, and starts a new Deck on it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

Copy link
Copy Markdown
Collaborator Author

Confirmed and fixed (bcf0994 on #11221, cherry-picked here as 4458288). Ownership is now decided by where the canvas came from rather than its class: Deck owns a canvas only if it created it (its own <canvas>, or the OffscreenCanvas of multi-canvas mode), so a canvas from an iframe is left to the app. New test in deck-release-context.spec.ts passes an iframe canvas (checking it fails instanceof HTMLCanvasElement), finalizes, then starts a new Deck on it; it fails without the fix. The teardown here follows #11221, so it will track whatever #11221 becomes.


Generated by Claude Code

@chrisgervang
chrisgervang requested a review from ibgreen November 19, 2026 14:17
chrisgervang pushed a commit that referenced this pull request Nov 19, 2026
Examples, test apps, the website and `deck.gl` now import `@deck.gl/react/legacy`
instead of the package root. Both export the same API today, so nothing changes
yet; when the root becomes the React renderer (#11183), these keep the current
API. Split out of #11183.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
`examples/` targets published deck.gl 9.x, whose @deck.gl/react has no
`/legacy` subpath, so it stays on the root import, as in #11240.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
The website renders the `examples/` apps, which import the package root. With
the root now the React 19 renderer, the React 18 website failed to render 17
pages. The website build maps the bare root to `/legacy`, so those apps keep the
current API until the v10 examples replace them; subpath imports are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Brings in master, including #11240. The examples-v10 and website import
conflicts take #11240's version, which already imports `/legacy`. The
"Heatmap filtering" whats-new section, which an earlier merge here dropped by
mistake, comes back with master's update.

Master added `_ColorScaleWidget` to @deck.gl/widgets (#11193), so the root
wraps it too, as the wrappers test requires for every widget class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-visgl__deck.gl that referenced this pull request Nov 19, 2026
…#11240)

* chore: import the current React API from @deck.gl/react/legacy

Examples, test apps, the website and `deck.gl` now import `@deck.gl/react/legacy`
instead of the package root. Both export the same API today, so nothing changes
yet; when the root becomes the React renderer (visgl#11183), these keep the current
API. Split out of visgl#11183.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

* chore: keep examples/ on the @deck.gl/react root

`examples/` targets published deck.gl 9.x, whose @deck.gl/react has no
`/legacy` subpath, so its standalone `start` would fail to resolve the import.
Only `examples-v10/`, the test apps, the website and `deck.gl` switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

---------

Co-authored-by: Claude <[email protected]>

Copy link
Copy Markdown
Collaborator Author

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

Awake999 pushed a commit to Awake999/deck.gl that referenced this pull request Nov 20, 2026
…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]>
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.

4 participants