Skip to content

[9.4-release] fix(core): keep the default view and widget id on a prototype (#11114) - #11303

Merged
chrisgervang merged 1 commit into
9.4-releasefrom
chr/backport-11114-9.4
Nov 24, 2026
Merged

chrisgervang merged 1 commit into
9.4-releasefrom
chr/backport-11114-9.4

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #11114, for #10972

Background

Backports #11114 to 9.4-release. The default view and widget id live on the props prototype, so {id: undefined} falls back to the class default and spreading props can't drop it.

Change List

  • Original commit, cherry-picked with -x
  • CustomProjectionView hunks dropped: that view isn't on 9.4
  • Unit tests, unchanged

The core views, lib and utils headless tests and the widgets headless tests pass on this branch. Lint is clean.


Note

Low Risk
Low risk refactor of view and widget props handling to keep default IDs on prototypes without altering public APIs.

Overview
Stores default IDs for View and Widget instances on the props prototype rather than as own properties via a new createPropsWithDefaultId utility. This allows external wrappers (such as React renderers) to distinguish between app-provided IDs and class defaults using Object.hasOwn.

Updates Widget.setProps, View.equals, and View.makeViewport to correctly handle prototype-backed default IDs when copying props or comparing view instances, and adds corresponding unit test coverage.

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

For #11113

- View, Widget: default id lives on the props prototype
- View#makeViewport: set id explicitly, so #3259 can't return
- View#equals: compare resolved ids, so new MapView() still equals new MapView({id: 'MapView'})
- Widget: {id: undefined} falls back to the default id, in the constructor and setProps
- Add createPropsWithDefaultId util, shared by View and Widget
- Unit tests

(cherry picked from commit 17085f1)

Backport to 9.4: drops the CustomProjectionView hunks; that view is not on 9.4.

@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 mentioned this pull request Nov 24, 2026
29 of 30 tasks
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Nov 24, 2026
@chrisgervang
chrisgervang merged commit eba57f1 into 9.4-release Nov 24, 2026
5 checks passed
@chrisgervang
chrisgervang deleted the chr/backport-11114-9.4 branch November 24, 2026 00:55
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage is 83.154% — chr/backport-11114-9.4 into 9.4-release. No base build found for 9.4-release.

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.

2 participants