Skip to content

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

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

chrisgervang merged 4 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 adds a guard against duplicate widget IDs without altering the normal widget lifecycle.

Overview
Prevents duplicate widgets with the same ID from being mounted in WidgetManager. When multiple widgets share an ID during setProps, subsequent widgets are ignored with a warning, preserving only the first instance and preventing leaked DOM elements.

Reviewed by Cursor Bugbot for commit bfff064. 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 <[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

[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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
@coveralls

coveralls commented Nov 7, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.746% (+0.002%) from 82.744% — chr/widget-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 be3aadf Nov 23, 2026
12 checks passed
@chrisgervang
chrisgervang deleted the chr/widget-manager-duplicate-ids branch November 23, 2026 02:38
chrisgervang added a commit that referenced this pull request Nov 23, 2026
* fix(core): mount one widget per id in WidgetManager

`_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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

* test(core): restore log.warn when the duplicate widget test fails

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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn

---------

Co-authored-by: Claude <[email protected]>
(cherry picked from commit be3aadf)
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Released in deck.gl 9.4.2.

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] WidgetManager mounts and leaks widgets that share an id

4 participants