Skip to content

feat: Partial application of theme vars#391

Merged
cb-ekuersch merged 8 commits intocds-v9from
cody/themeprovider-partial-css
Feb 12, 2026
Merged

feat: Partial application of theme vars#391
cb-ekuersch merged 8 commits intocds-v9from
cody/themeprovider-partial-css

Conversation

@cb-ekuersch
Copy link
Copy Markdown
Contributor

What changed? Why?

Original PR: #114

See the original PR for more details.
This change introduces an optimization to ThemeProvider so that in nested instances of a ThemeProvider, it will only inject new/changed theme vars into the inline styles.

This introduces a change in behavior that could affect customers who are rendering ThemeProviders in their own React DOM portals. For these customers, they must explicitly use the new isolated prop of the ThemeProvider.

Root cause (required for bugfixes)

UI changes

iOS Old iOS New
old screenshot new screenshot
Android Old Android New
old screenshot new screenshot
Web Old Web New
old screenshot new screenshot

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

<CodeBlock className={styles.jsonCodeBlock} language="json">
{JSON.stringify(json, null, 2)}
</CodeBlock>
<>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mdx content rendered beneath this JSONCodeBlock wouldn't have any space between

@cb-ekuersch cb-ekuersch force-pushed the cody/themeprovider-partial-css branch from 04700f4 to e5bf761 Compare February 12, 2026 19:02
@cb-ekuersch cb-ekuersch changed the title Partial application of theme vars feat: Partial application of theme vars Feb 12, 2026
};

export const ThemeProvider = ({ theme, activeColorScheme, children }: ThemeProviderProps) => {
export const ThemeProvider = memo(({ theme, activeColorScheme, children }: ThemeProviderProps) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if memo here is intentional. Since children creates a new reference, it seems like this wouldn’t prevent re-renders.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is probably an issue with all of our components that accept children, but at least here we are consistent with the optimization pattern applied to most of our components

);
};
export const InvertedThemeProvider = memo(
({ children, display, className, style }: InvertedThemeProviderProps) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should InvertedThemeProvider also support isolated prop?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!!

stacysun-cb
stacysun-cb previously approved these changes Feb 12, 2026
@cb-heimdall
Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

@cb-ekuersch cb-ekuersch merged commit c47c886 into cds-v9 Feb 12, 2026
10 of 15 checks passed
@cb-ekuersch cb-ekuersch deleted the cody/themeprovider-partial-css branch February 12, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants