Skip to content

What the idea behind deep merging if theme class name contains in parent class #15

@istarkov

Description

@istarkov

Thank you for this library, I have a small question about COMPOSE_DEEPLY logic.

Having function themeable

I got that merging style and theme objects has following logic.

const style = { a: 'xxx'};
const theme = { a: 'yyy'};
themeable(style, theme); // the result is {hello: "xxx yyy"}

const theme2 = { a: 'xxxzzz'};
themeable(style, theme2); // the result is {hello: "xxxzzz"}

so in first themeable call - classes are combined together but in the second call the theme class wins.

The only situation I see it's needed is to avoid class duplication if theme and style are the same css-module class names - and this will not work in all cases.

const style = { a: 'xxx aaa'};
const theme = { a: 'xxx zzz'};
themeable(style, theme); // the result is {hello: "xxx aaa xxx zzz"} xxx is duplicated

Is any other behaviors why it's needed? Please help to get the logic of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions