Repository navigation
fix(provider): merge the theme prop deeply - #5234
Merged
Merged
Conversation
PaperProvider spread the theme's top-level keys and merged only colors
one level deep, so a partial nested object replaced the default whole.
A theme with only `motion: { duration: { short3: 300 } }` type-checked
but crashed every component at render, and a partial `shapes.corner`
left the other corner roles undefined. Merge with safeMerge, as a
component's theme prop already does, so a partial override keeps every
key it leaves out.
|
Found potential problems with the pull request:
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 71a5dfc. The verdict and the full list are in the summary comment.
The guide now says a custom theme only needs the properties it changes, while its examples still spread LightTheme or DarkTheme. Explain that the spread sets dark and gives TypeScript the full Theme shape, and that nested spreads are optional otherwise.
This comment has been minimized.
This comment has been minimized.
Removed comments explaining theme merging process.
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
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.
Motivation
PaperProvidermerged onlycolorsone level deep, so a partial nested object replaced the default whole.theme={{ motion: { duration: { short3: 300 } } }}type-checked but crashed every component at render, and a partialshapes.cornerleft the other cornersundefined. The provider now usessafeMerge, like a component'sthemeprop. Complete themes give the same result. The guides drop the spread workaround.Related issue
None.
Screenshots / Videos
None: themes that worked render the same.
Test plan
yarn test: partialmotion,shapes,colors.elevationandfonts, easing arrays, platform colors.motiontheme renders. Onmainit throws (web, iOS).