Repository navigation
[9.4-release] fix(core): keep the default view and widget id on a prototype (#11114) - #11303
Merged
Merged
Conversation
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.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
29 of 30 tasks
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.
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
-xCustomProjectionViewhunks dropped: that view isn't on 9.4The 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
ViewandWidgetinstances on the props prototype rather than as own properties via a newcreatePropsWithDefaultIdutility. This allows external wrappers (such as React renderers) to distinguish between app-provided IDs and class defaults usingObject.hasOwn.Updates
Widget.setProps,View.equals, andView.makeViewportto 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.