Skip to content

feat(react): give elements without an id one from their place in the React tree - #11271

Merged
chrisgervang merged 1 commit into
masterfrom
chr/react-generated-ids
Nov 22, 2026
Merged

chrisgervang merged 1 commit into
masterfrom
chr/react-generated-ids

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

For #11036

Follow up of visgl/deck.gl-community#1077, which has the reasoning and measurements (visgl/deck.gl-community#1076 has the id format and the collision proof).

Background

Layers, views, widgets and effects without an id all get their class default, so siblings collide: deck.gl reinitializes one of them on every update and never finalizes the one it replaced. The renderer now gives each such element an id built from its React key or position, and never changes an id the app passed. #11114 made "passed an id equal to the default" detectable for views and widgets.

Change List

  • reconciler/element-ids.ts (new): path-based ids and a dev-only duplicate-id warning
  • shared/generated-effect-id.ts (new): marks effects that a component built
  • reconciler/config.ts: stores each element's path; hidden clones keep it
  • reconciler/utils.ts: prop entries replace JSX elements by final id
  • wrappers/factories.tsx: effect components mark their effect
  • Removes the dead needs a stable id warning
  • Unit tests, including fast-check property tests of the id format

TODO


Note

Medium Risk
Modifies element identification and descriptor merging in the React reconciler, directly affecting layer, view, widget, and effect lifecycle matching in deck.gl.

Overview
Automatically assigns deterministic IDs to <deckLayer>, <deckView>, <deckWidget>, and wrapper-created effect elements that lack an explicit id prop, derived from their position and keys in the React fiber tree. This prevents ID collisions among sibling elements that previously fell back to shared class default IDs, which caused deck.gl to repeatedly reinitialize instances.

The reconciler now tracks each element's fiber path on its instance, preserving generated IDs through clones, memoized renders, and Suspense fallback states. Additionally, descriptor merging is unified through mergeById using final element IDs, and a development-only check reports duplicate IDs across JSX elements and root props.

Reviewed by Cursor Bugbot for commit 16baf49. Bugbot is set up for automated code reviews on this repo. Configure here.


Generated by Claude Code

…React tree

Replays visgl/deck.gl-community#1077 onto @deck.gl/react, now that #11114
keeps the default view and widget id on the props prototype.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
@chrisgervang
chrisgervang requested a review from ibgreen November 21, 2026 18:17

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 82.894% (+0.05%) from 82.845% — chr/react-generated-ids into master

@chrisgervang
chrisgervang merged commit 69b44bd into master Nov 22, 2026
8 checks passed
@chrisgervang
chrisgervang deleted the chr/react-generated-ids branch November 22, 2026 21:05
chrisgervang pushed a commit that referenced this pull request Nov 22, 2026
Resolves the renderer.ts conflict with #11271: a prop-only update keeps
prepareRootUpdate (duplicate-id check and sentViews) and adds the removed-prop
reset and the creation-only warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
chrisgervang added a commit that referenced this pull request Nov 23, 2026
For #11036. Closes #11037

- Renderer docs in api-reference/react and developer-guide/react; the previous API's pages are under /legacy (#11254)
- Migration guide from @deck.gl/react 9, upgrade-guide entry and what's new
- Ids: elements without an id get one from their place in the React tree (#11271)
- DeckGL: removed props reset to their defaults, and props that only apply at creation (#11267)
- Sidebar: a "Using with React" guide section
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.

3 participants