deck.gl: decide what the umbrella package exports from @deck.gl/react in v10

Open
#11,324 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
8/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Active
Tech stack
react, typescript

Research direction

This is a design decision, not a code change. Start with modules/main/src/index.ts, which re-exports DeckGL and the types from @deck.gl/react/legacy, and with the react peer range in the umbrella's package.json. Read the findings on React 18 import failures and the React Server Components note before proposing an option. Done means the decision is recorded in this issue and the umbrella exports, peer range, upgrade guide and What's new all match it.

Written by the indexing model from the issue text.

Description

Background

The deck.gl umbrella package still exports the previous React API (modules/main/src/index.ts):

export {default, DeckGL} from '@deck.gl/react/legacy';
export type {DeckGLProps, DeckGLRef, DeckGLContextValue} from '@deck.gl/react/legacy';

So in v10, import {DeckGL} from 'deck.gl' gives the previous API, while the docs and examples teach DeckGL from @deck.gl/react. The get-started basic app was a legacy app for this reason until #11320. We need to decide what the umbrella exports before v10.

Options being investigated

  1. Switch to the new renderer. DeckGL from deck.gl is the @deck.gl/react root, and the previous API is exported as DeckGLLegacy.
  2. Keep the previous API for v10. Switch in v11, when /legacy is removed.
  3. Stop exporting React from the umbrella. React apps import @deck.gl/react directly, and the umbrella drops its react peer.

With option 1 or 2, two more questions:

  • The default export. import DeckGL from 'deck.gl' is common in v9 code. It could be removed (@deck.gl/react has only named exports, so old code fails at build with a clear error), point at the new renderer, or stay on the previous API.
  • The types. DeckGLProps would come from @deck.gl/react. DeckGLRef and DeckGLContextValue exist only in the previous API.

Findings so far

Tested with the published 10.0.0-alpha.2 packages and a local stand-in for a switched umbrella:

  • Bundled apps are unaffected. The umbrella is sideEffects: false. A React 18 app built with Vite that imports only layers, or the previous API, from a switched umbrella doesn't bundle react-reconciler and renders with no errors.
  • Unbundled imports on React 16.3 to 18 would break with option 1. Importing the @deck.gl/react root on React 18 throws at load: Cannot read properties of undefined (reading 'S') from react-reconciler. An ESM import of the umbrella loads every re-export, so Node SSR or Jest and Vitest tests that import deck.gl would throw, even for code that only uses layers. The previous API loads on React 18.
  • The peer ranges already disagree. @deck.gl/react peers on react ^19.2.0 for the whole package, /legacy included (#11036), while the umbrella declares an optional react >=16.3.0.
  • React Server Components already fail. Under the react-server condition, both the new renderer and the previous API throw at import, so importing deck.gl from a server component fails today with option 1 or 2. Only option 3 changes that.

Done when

The decision is recorded here, and modules/main exports, its react peer range, the upgrade guide and What's new match it.

Dominant language
TypeScript
Stars
14.8k
Forks
2.3k
Avg merge
1d 9h
Merged PRs (30d)
230

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from visgl/deck.gl

All issues in visgl/deck.gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.