Skip to content

Commit 446e820

Browse files
HerrTopiclaude
andcommitted
fix(emotion): propagate resolved component theme override to wrapped component
Merge the SettingsProvider component overrides with the resolved themeOverride prop and pass the result down as `themeOverride`, so nested components receive the effective overrides. Default missing overrides to an empty object to avoid merging undefined. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 99141c0 commit 446e820

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

packages/emotion/src/withStyleNew.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ const withStyleNew = decorator(
190190
const semanticsOverrides = themeOverride?.semantics
191191
const sharedTokensOverrides = themeOverride?.sharedTokens
192192
const componentOverridesFromSettingsProvider =
193-
themeOverride?.components?.[rawComponentId]
193+
themeOverride?.components?.[rawComponentId] ?? {}
194194
const componentOverridesFromThemeOverrideProp = (
195195
componentProps as ThemeOverrideProp
196196
).themeOverride
@@ -225,15 +225,23 @@ const withStyleNew = decorator(
225225
componentOverridesFromSettingsProvider as Record<string, unknown>
226226
)
227227

228-
const componentTheme = mergeDeep(
229-
componentThemeFromSettingsProvider,
230-
// @ts-ignore TODO-theme-types: fix typing
231-
typeof componentOverridesFromThemeOverrideProp === 'function'
228+
const resolvedComponentOverrideFromThemeOverrideProp =
229+
(typeof componentOverridesFromThemeOverrideProp === 'function'
232230
? componentOverridesFromThemeOverrideProp(
233231
componentThemeFromSettingsProvider,
234232
themeInContext
235233
)
236-
: componentOverridesFromThemeOverrideProp
234+
: componentOverridesFromThemeOverrideProp) ?? {}
235+
236+
const componentTheme = mergeDeep(
237+
componentThemeFromSettingsProvider,
238+
// @ts-ignore TODO-theme-types: fix typing
239+
resolvedComponentOverrideFromThemeOverrideProp
240+
)
241+
242+
const derivedComponentOverride = mergeDeep(
243+
componentOverridesFromSettingsProvider,
244+
resolvedComponentOverrideFromThemeOverrideProp
237245
)
238246

239247
// TODO do not call here generateStyle, it does not receive the extraArgs
@@ -263,6 +271,7 @@ const withStyleNew = decorator(
263271
{...props}
264272
makeStyles={makeStyleHandler}
265273
styles={styles}
274+
themeOverride={derivedComponentOverride}
266275
/>
267276
)
268277
})

packages/ui-tree-browser/src/TreeBrowser/v2/TreeNode/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ in the TreeBrowser.
5454
class TreeNode extends Component<TreeBrowserNodeProps, { isHovered: boolean }> {
5555
static displayName = 'TreeNode'
5656
static readonly componentId = 'TreeBrowser.Node'
57-
static readonly themeId = 'TreeBrowserTreeButton'
57+
static readonly themeId = 'TreeBrowserTreeNode'
5858

5959
static allowedProps = allowedProps
6060

0 commit comments

Comments
 (0)