Skip to content

fix(provider): merge the theme prop deeply - #5234

Merged
Doberjohn merged 3 commits into
mainfrom
@Doberjohn/provider-deep-merge
Nov 18, 2026
Merged

Doberjohn merged 3 commits into
mainfrom
@Doberjohn/provider-deep-merge

Conversation

@Doberjohn

Copy link
Copy Markdown
Collaborator

Motivation

PaperProvider merged only colors one 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 partial shapes.corner left the other corners undefined. The provider now uses safeMerge, like a component's theme prop. 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: partial motion, shapes, colors.elevation and fonts, easing arrays, platform colors.
  • iOS 27.2, Android 13, web: the example with a partial motion theme renders. On main it throws (web, iOS).

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.
@github-actions

Copy link
Copy Markdown

Found potential problems with the pull request:

  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging 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.

Apex Sentinel: 1 new finding on 71a5dfc. The verdict and the full list are in the summary comment.

Comment thread docs/6.x/docs/guides/theming.mdx Resolved
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.
@apex-sentinel-staging

This comment has been minimized.

Removed comments explaining theme merging process.
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of f963da2

Since the review of e8acd40: 0 new · 0 still open · 0 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (dd4ea6efbf59).

💬 Talking to Sentinel

In a finding's thread, reply with:

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.

@Doberjohn
Doberjohn merged commit 1e20a68 into main Nov 18, 2026
14 checks passed
@Doberjohn
Doberjohn deleted the @Doberjohn/provider-deep-merge branch November 18, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant