Skip to content

fix(core): give duplicate view ids one controller in ViewManager - #11065

Merged
chrisgervang merged 3 commits into
masterfrom
chr/view-manager-duplicate-ids
Nov 23, 2026
Merged

chrisgervang merged 3 commits into
masterfrom
chr/view-manager-duplicate-ids

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #11067

Background

Every view is still drawn, because two MapViews without an explicit id share the default id. Controllers and view event managers go only to the first view with each id, which matches getView and getViewport, so no controller is created that ViewManager can't finalize. The warning is issued when views change, not on every view state update.

Change List

  • ViewManager: warn "Multiple views with same id" when views change
  • ViewManager: only the first view per id gets a controller
  • Unit tests

Verified with the core headless suite (635 tests) and yarn lint.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn


Note

Low Risk
Low risk bug fix that prevents orphaned controllers when duplicate view IDs exist without altering viewport rendering.

Overview
Prevents controller leaks when multiple views share the same ID in ViewManager.

While all duplicate views continue to be drawn as viewports, only the first view with a given ID is now assigned a controller and event manager. In addition, ViewManager now emits a warning when duplicate view IDs are detected during view updates.

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

ViewManager keys controllers, view event managers and viewport lookups by
view id. With two views sharing an id, `_rebuildViewports` created a
controller for each, and the second overwrote the first in
`controllers[id]`, so the overwritten one was never finalized. Later
rebuilds reused the surviving controller for both views, applying both
layouts to it in turn.

Warn with "Multiple views with same id" when views change, as LayerManager
does for layers. Keep drawing every view, since two `MapView`s without an
explicit id share the default id, but give controllers and event managers
only to the first view with each id, matching `getView` and
`getViewport`. This resolves the TODO in `_buildViewportMap`.

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

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

ViewManager keeps drawing duplicate-id views but gives only the first one a controller and event-manager entry.

  • Duplicate views still draw, while the first view handles input.

Reviews (2) · Last reviewed commit: "Merge branch 'master' into chr/view-mana..." · Reviewed by Greptile

@coveralls

coveralls commented Nov 7, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.749% (+0.005%) from 82.744% — chr/view-manager-duplicate-ids into master

@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.

@chrisgervang
chrisgervang added this pull request to the merge queue Nov 23, 2026
Merged via the queue into master with commit 6d1ccaf Nov 23, 2026
12 checks passed
@chrisgervang
chrisgervang deleted the chr/view-manager-duplicate-ids branch November 23, 2026 02:49
chrisgervang added a commit that referenced this pull request Nov 23, 2026
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Released in deck.gl 9.4.2, as #11295 on 9.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ViewManager leaks a controller when views share an id

4 participants