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

Missing params on partial theme merge #253

Closed
2 tasks done
markov00 opened this issue Jul 2, 2019 · 3 comments · Fixed by #256 or elastic/kibana#40751
Closed
2 tasks done

Missing params on partial theme merge #253

markov00 opened this issue Jul 2, 2019 · 3 comments · Fixed by #256 or elastic/kibana#40751
Assignees
Labels
bug Something isn't working released Issue released publicly :styling Styling related issue

Comments

@markov00
Copy link
Member

markov00 commented Jul 2, 2019

Describe the bug
I think we miss an important part on the mergePartial function. We actually relay on the fact that the default theme has all the property in place, and we are merging the partial theme on top of those properties. The problem comes when we want to merge in a property that is undefined on the default theme, like the dash array of a StrokeStyle. The merge should take all the elements from the default theme + all the element of the partial and merge them together.

To Reproduce
Steps to reproduce the behavior: add a test with the following code:

 test('should merge optional parameters', () => {
  interface OptionalTestType {
    value1: string;
    value2?: number;
    value3: string;
  }
  const defaultBase: OptionalTestType = {
    value1: 'foo',
    value3: 'bar',
  };
  const partial: RecursivePartial<OptionalTestType> = { value1: 'baz', value2: 10 };
  const merged = mergePartial(defaultBase, partial);
  expect(merged).toEqual({
    value1: 'baz',
    value2: 10,
    value3: 'bar',
  });
});

Expected behavior
Merging two object will results in a merge, not just on an object overwritten with the partial values.

Screenshots
n/a

Version (please complete the following information):

  • OS: all
  • Browser: all
  • Elastic Charts: 7.0.1

Additional context
n/a

Errors in browser console
n/a

Kibana Cross Issues
n/a

Checklist

  • every related Kibana issue is listed under Kibana Cross Issues list
  • kibana cross issue tag is associated to the issue if any kibana cross issue is present
@markov00 markov00 added bug Something isn't working :styling Styling related issue labels Jul 2, 2019
@nickofthyme
Copy link
Collaborator

@markov00 Ya that was one of the edge cases I neglected to consider thinking we would always have a default value. I'll take a look.

nickofthyme added a commit to nickofthyme/elastic-charts that referenced this issue Jul 2, 2019
nickofthyme added a commit that referenced this issue Jul 2, 2019
Allow the option to merge optional partial params on a partial `Theme`.

fix #253
@nickofthyme
Copy link
Collaborator

Closed with #256

markov00 pushed a commit that referenced this issue Jul 3, 2019
## [7.0.2](v7.0.1...v7.0.2) (2019-07-03)

### Bug Fixes

* **theme:** merge optional params ([#256](#256)) ([9cd660c](9cd660c)), closes [#253](#253)
@markov00
Copy link
Member Author

markov00 commented Jul 3, 2019

🎉 This issue has been resolved in version 7.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Jul 3, 2019
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this issue Feb 10, 2022
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