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
Describe the bug
I think we miss an important part on the
mergePartialfunction. 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 isundefinedon the default theme, like thedasharray of aStrokeStyle. 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:
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):
Additional context
n/a
Errors in browser console
n/a
Kibana Cross Issues
n/a
Checklist
Kibana Cross Issueslistkibana cross issuetag is associated to the issue if any kibana cross issue is present