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

Theme overrides are not applied with missing optional base values #1284

Closed
nickofthyme opened this issue Aug 4, 2021 · 5 comments · Fixed by #1452
Closed

Theme overrides are not applied with missing optional base values #1284

nickofthyme opened this issue Aug 4, 2021 · 5 comments · Fixed by #1452
Assignees
Labels
bug Something isn't working released Issue released publicly :styling Styling related issue

Comments

@nickofthyme
Copy link
Collaborator

nickofthyme commented Aug 4, 2021

Describe the bug
When using a theme override in certain circumstances the first values do NOT take precedence and revert to the baseTheme value.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/happy-violet-xcb3z?file=/src/App.tsx

Expected behaviour
In the example codesandbox above, I expect the crosshair value to be applied from theme2 but it is actually being applied from the baseTheme.

Additional context
Likely related to the mergeOptionalPartialValues option on the mergePartial utility function.

Related to https://github.com/elastic/kibana/pull/106845/files/039ca4ef1a815cc9d76c9ebbad3ce7a00be26115..ac3eb6a10fbe552743d7a9075c104a2c010ea043

@nickofthyme nickofthyme added bug Something isn't working :styling Styling related issue labels Aug 4, 2021
@nickofthyme nickofthyme self-assigned this Aug 4, 2021
@rshen91 rshen91 assigned rshen91 and unassigned nickofthyme Sep 14, 2021
@rshen91
Copy link
Contributor

rshen91 commented Sep 15, 2021

@nickofthyme I think I'm following. The issue I'm facing is that I'm not able to get this theme override to work without setting up the tooltip prop in the <Settings />. I kind of used the Grid lines.story.tsx as an example, but I wasn't able to get the crosshair cursor to work at all without setting tooltip={getTooltipTypeKnob('Tooltip type', TooltipType.Crosshairs)}

https://codesandbox.io/embed/ancient-leftpad-9klp9?fontsize=14&hidenavigation=1&theme=dark

@rshen91
Copy link
Contributor

rshen91 commented Sep 15, 2021

I think in kibana to get the cursor to be crosshairs changing the TooltipProps to the following is showing:

const tooltipProps: TooltipProps = tooltip.detailedTooltip
    ? {
        ...tooltip,
        type: TooltipType.Crosshairs,
        boundary,
        customTooltip: tooltip.detailedTooltip(headerFormatter),
        headerFormatter: undefined,
      }
    : { ...tooltip, boundary, headerFormatter };

@rshen91
Copy link
Contributor

rshen91 commented Sep 20, 2021

Thanks for the zoom to clarify @nickofthyme 👍🏻

@nickofthyme nickofthyme changed the title Theme overrides not working perfectly Theme overrides are not applied with missing optional base values Sep 28, 2021
@nickofthyme
Copy link
Collaborator Author

Fixed in #1410 by making mergeOptionalPartials true by default.

@nickofthyme
Copy link
Collaborator Author

🎉 This issue has been resolved in version 38.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nickofthyme nickofthyme added the released Issue released publicly label Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Issue released publicly :styling Styling related issue
Projects
None yet
2 participants