Repository navigation
fix(react): reset removed props, and warn about props that only apply at creation - #11267
Conversation
… at creation Replays visgl/deck.gl-community#1088 onto @deck.gl/react. #10906 made Deck fall back to the default for a prop passed as undefined, so the root only resets props that a render removed, and passes undefined through. - A prop the last configure had and this one doesn't is sent as its Deck default. layers, views, widgets and effects are left out of that spread, so views={undefined} can't clear views that a widget such as SplitterWidget set. - An overlay that doesn't forward JSX views follows the same views rule with its views prop alone. - In development builds, changing deviceProps, gl, debug, touchAction, eventRecognizerOptions or _typedArrayManagerProps after creation warns once per prop per root, with a link to the DeckGL docs. The community PR's yarn patch isn't needed: deck.gl builds @deck.gl/core from source, which includes #10906. Its creation-only test runs in the jsdom react project, where vi.stubEnv reaches process.env. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
A live Deck can't take their defaults. Deck.setProps only swaps in a new device, so sending null left Deck rendering with its device while its props said null. _canvases chose single- or multi-canvas mode, and Deck.setProps asserts that the mode never changes, so sending null threw. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
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 5da98e8. Configure here.
Deck.setProps resets an explicit undefined to its default (#10906), so passing device or _canvases as undefined hit the same problems as removing them. The root leaves either out of setProps when it is undefined, as when it is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
ibgreen
left a comment
There was a problem hiding this comment.
One browser-compatibility regression in the prop-reset helper.
Safari 15.0-15.3 lack Object.hasOwn, so the second configure threw there. getRemovedProps uses Object.prototype.hasOwnProperty.call, as #11114 does, with the same own-property semantics. A test runs two configures with Object.hasOwn removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
… renderer @deck.gl/react - DeckGL: removed props reset to deck.gl's defaults; table of props that only apply at creation (from visgl/deck.gl-community#1088, code in #11267) - Migration guide: "Removed props reset"; using-with-maps links the table - DeckCanvas now lives in @deck.gl-community/react; link it there - Replace "React Fiber" with @deck.gl/react or "the renderer" Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Resolves the renderer.ts conflict with #11271: a prop-only update keeps prepareRootUpdate (duplicate-id check and sentViews) and adds the removed-prop reset and the creation-only warning. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
…nly warning in one root Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Two red results on add1bf7, neither from this PR:
Generated by Claude Code |
For #11036. Closes #11037 - Renderer docs in api-reference/react and developer-guide/react; the previous API's pages are under /legacy (#11254) - Migration guide from @deck.gl/react 9, upgrade-guide entry and what's new - Ids: elements without an id get one from their place in the React tree (#11271) - DeckGL: removed props reset to their defaults, and props that only apply at creation (#11267) - Sidebar: a "Using with React" guide section

For #11036
Background
Replays visgl/deck.gl-community#1088 onto
@deck.gl/react.Deck.setPropsmerges into the props it holds, so a prop a render stops passing kept its old value. With #10906,Deckfalls back to the default for a prop passed asundefined, so the root only resets removed props. The community PR's yarn patch isn't needed here.Change List
@deck.gl/react: reset a removed prop to itsDeckdefaultlayers,views,widgetsandeffectsto the descriptor mergeviewspropTODO
Note
Low Risk
Updates React reconciler prop synchronization for Deck.gl instances; changes are isolated to
@deck.gl/reactand accompanied by comprehensive tests.Overview
Updates the React reconciler in
@deck.gl/reactto reset omitted props back to theirDeck.defaultPropsvalues on re-renders. BecauseDeck.setPropsmerges into existing configuration, previously removed props retained their prior values instead of reverting to defaults.Additionally, warns in development when props that only apply at instance creation (such as
gl,touchAction, anddeviceProps) change between renders. Also updatescombineRootDescriptorsso external overlays that do not forward JSX views properly respect and reset their ownviewsprop.Reviewed by Cursor Bugbot for commit add1bf7. Bugbot is set up for automated code reviews on this repo. Configure here.
Generated by Claude Code