Skip to content

fix(core): treat a falsy widget id as the class default, as views do - #11135

Merged
chrisgervang merged 6 commits into
masterfrom
chr/widget-falsy-default-id
Nov 23, 2026
Merged

chrisgervang merged 6 commits into
masterfrom
chr/widget-falsy-default-id

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

For #11113

Background

View (#1379) and Viewport (viewport.ts:281) treat any falsy id as the class default. Widget used props.id ?? this.id (#8072) until #9576's spread, so '' and null are kept and collide in WidgetManager. Views can't keep '' instead, or a view and its viewport would get different ids (the #3259 bug). Widgets now follow the view rule.

Change List

  • Widget: falsy id uses the class default, in the constructor and setProps; reads only an own id
  • createPropsWithDefaultId: document the shared falsy-id rule
  • Unit tests
  • Documentation
  • Upgrade guide
  • Verified with yarn lint, tsc on core, and the core and widgets headless tests

TODO

  • Layers keep an explicit id: undefined as the id; possible follow-up

Generated by Claude Code


Note

Low Risk
Low risk change aligning widget ID fallback behavior with views to prevent ID collisions.

Overview
Updates Widget to treat falsy id values ('' and null) as unspecified, falling back to the widget's default ID. This aligns with View behavior and prevents widgets without an explicit ID from colliding and replacing each other in WidgetManager.

Additionally, the widget constructor now inspects only own properties for id, ensuring inherited default IDs copied from existing widget props are not incorrectly treated as user-supplied.

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


Generated by Claude Code

Like layer props, `View` and `Widget` now keep their default `id` on the
props prototype, so `Object.hasOwn(props, 'id')` tells a passed id from
the default while `props.id` still reads the resolved id.

- `makeViewport` sets `id` explicitly, since spreading props drops it
- `View#equals` compares resolved ids, so an implicit and an explicit
  default id stay equal

For #11113

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

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Widgets now use their class default when constructed with an empty or null id, matching views.

  • Widgets with empty IDs now use their class default.

No new actionable issues found. Tests were not run during this review.

Reviews (2) · Last reviewed commit: "fix(core): treat a falsy widget id as th..." · Reviewed by Greptile

@coveralls

coveralls commented Nov 15, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.849% (+0.004%) from 82.845% — chr/widget-falsy-default-id into master

Takes master's #11114 (squash-merged) for the files this branch stacked on,
keeps this PR's own change, and extends it to setProps: since #11114, setProps
treats an undefined id as the class default, and it now does so for any falsy id.

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

@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 233a1f5 Nov 23, 2026
8 checks passed
@chrisgervang
chrisgervang deleted the chr/widget-falsy-default-id branch November 23, 2026 02:02
@chrisgervang chrisgervang mentioned this pull request Nov 24, 2026
29 tasks
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.

4 participants