Visitar URL original
fix(core): mount one widget per id in WidgetManager by chrisgervang · Pull Request #11064 · visgl/deck.gl · GitHub
Skip to content

fix(core): mount one widget per id in WidgetManager - #11064

Open
chrisgervang wants to merge 3 commits into
masterfrom
chr/widget-manager-duplicate-ids
Open

chrisgervang wants to merge 3 commits into
masterfrom
chr/widget-manager-duplicate-ids

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #11066

Background

_setWidgets treats the null "already matched" marker the same as a missing id, so a second widget with the same id is mounted. Updates after that leak one more widget each. This PR handles null the way LayerManager does: it warns and keeps the first widget with each id.

Change List

  • WidgetManager: warn "Multiple widgets with same id", keep the first
  • Unit tests

Verified with the core and widgets headless suites (340 tests) and yarn lint.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn


Note

Low Risk
Low risk bug fix that avoids duplicate widget mounting and DOM element leaks without changing standard widget reconciliation.

Overview
Prevents WidgetManager from mounting duplicate widgets that share the same ID during widget reconciliation. When an ID has already been matched in the current update cycle (oldWidget === null), WidgetManager now logs a warning and skips subsequent widgets with that ID rather than treating them as new widgets and leaking DOM elements.

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

`_setWidgets` marks an id as matched by setting it to `null`, but then
treated `null` like a missing entry. A second widget with the same id was
mounted as new, and on the next update the first one was no longer in
the id map, so it was never removed. Each update with a duplicate id
leaked another widget into the DOM.

Warn with "Multiple widgets with same id", as LayerManager does for
layers, and keep the first widget with each id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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

[Low impact] The PR appears safe to merge, with the previous test cleanup issue fixed.

Summary

WidgetManager now warns and skips duplicate widget IDs, keeping the first widget.

  • Widget lists keep only the first widget for each ID.

Reviews (3) · Last reviewed commit: "test(core): restore log.warn when the du..." · Reviewed by Greptile

chrisgervang and others added 2 commits November 7, 2026 14:29
The headless suite runs without isolation, so a failed assertion would
leave `log.warn` muted for the tests that follow. Restore it in `finally`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
@coveralls

coveralls commented Nov 7, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.706%. remained the same — chr/widget-manager-duplicate-ids into master

@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Nov 12, 2026

This branch has not been deployed

No deployments
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.

[Bug] WidgetManager mounts and leaks widgets that share an id

3 participants