Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use deepmerge themes when overriding #36

Open
alexislightspeed opened this issue Oct 31, 2019 · 1 comment
Open

Use deepmerge themes when overriding #36

alexislightspeed opened this issue Oct 31, 2019 · 1 comment
Labels
good first issue Good for newcomers

Comments

@alexislightspeed
Copy link
Contributor

Description

Provide a high-level summary of your issue.

return <ThemeProvider theme={{ ...selectedTheme, ...themeOverrides }}>{children}</ThemeProvider>;

Rather than spreading both objects together, use deepmerge so that a new theme may extend the ThemeUI without fully overriding the original theme.

What do you think should have happened?

The color would be deepmerged. Instead the color is overwritten by the ThemeOverride

Steps to reproduce the problem

const existingTheme = {col:{blue:'blue'}};
const newTheme = {col:{red:'red'}};
const mergedTheme = {...existingTheme, ...newTheme};
console.log(mergedTheme);
:rip:

Specifications

  • Affected component(s): Core / FlameTheme
@alexislightspeed alexislightspeed added the good first issue Good for newcomers label Oct 31, 2019
@glambert
Copy link
Collaborator

glambert commented Nov 4, 2019

@xdrdak are we restricting this for a reason? Should we instead document how to override on the consumer-side and at that point recommend using deepmerge for example?

@glambert glambert changed the title deepmerge themes when overriding Use deepmerge themes when overriding Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants