Repository navigation
fix(core): replace a matched widget when its type changes in WidgetManager - #11115
Merged
Merged
Conversation
The widget RFC treats two widgets as the same only if they share a constructor and an id. WidgetManager compared ids only, so a widget of another class with the same id was updated with the new widget's props instead of being replaced. For #11113 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
[Medium impact] The PR appears safe to merge; no new actionable issue remains. Summary
Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mas..." · Reviewed by Greptile |
26 tasks
Match widgets by id, and use the class default id (defaultProps.id) rather than the constructor to decide whether the old instance can be reused. The default id is unique per class and survives hot module reloads, so a reloaded widget class keeps its mounted instance. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 00c5d21. Configure here.
…match-constructor
This was referenced Nov 16, 2026
This was referenced Nov 22, 2026
chrisgervang
added a commit
that referenced
this pull request
Nov 23, 2026
…nager (#11115) * fix(core): match widgets by class and id in WidgetManager The widget RFC treats two widgets as the same only if they share a constructor and an id. WidgetManager compared ids only, so a widget of another class with the same id was updated with the new widget's props instead of being replaced. For #11113 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn * fix(core): compare the widget type by class default id Match widgets by id, and use the class default id (defaultProps.id) rather than the constructor to decide whether the old instance can be reused. The default id is unique per class and survives hot module reloads, so a reloaded widget class keeps its mounted instance. 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 b864248)
Collaborator
Author
|
Released in deck.gl 9.4.2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

For #11113
Background
The widget RFC (#7512) treats two widgets as the same only if they share a constructor and an id.
WidgetManager._setWidgetscompares ids only, so a widget of another class with the same id is updated witholdWidget.setProps(widget.props)and keeps rendering as the old class. Independent of #11064, which handles duplicate ids within one list; the two merge without conflicts.The id stays the widget's identity. The type only decides whether the old instance is reused or replaced. The type is the class default id (
defaultProps.id, unique per class since #11116), not the constructor. A hot module reload, or a second copy of a package, creates a new class with the same default id, and comparing constructors would remount the widget and lose its state on every reload.A custom widget that doesn't set its own default id has the same type as its parent class, so it is still updated in place, as today.
Change List
WidgetManager: replace a matched widget when its type (class default id) differsVerified with the
headlesstests forwidget-manager.spec.ts; the reload test fails with a constructor comparison. Prettier passes on the changed files.Note
Low Risk
Low risk scoped bug fix in widget reconciliation logic with accompanying unit tests.
Overview
Updates
WidgetManagerto replace an existing widget instance when a new widget with the sameidhas a different widget type.Previously, widgets were matched solely by
id, which could pass props from one widget class to an instance of another. Widget types are determined by comparingdefaultProps.id, ensuring different widget classes are replaced while still reusing instances across hot module reloads.Reviewed by Cursor Bugbot for commit 9295542. Bugbot is set up for automated code reviews on this repo. Configure here.