fixing multiple metrics (#62929) (#62961)

This commit is contained in:
Peter Pisljar 2020-04-09 11:01:06 +02:00 committed by GitHub
parent 9645f6f4ab
commit 9aa599c18d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View file

@ -54,6 +54,7 @@ exports[`MetricsAxisOptions component should init with the default set of props
}
vis={
Object {
"serialize": [MockFunction],
"setState": [MockFunction],
"type": Object {
"schemas": Object {
@ -126,6 +127,7 @@ exports[`MetricsAxisOptions component should init with the default set of props
}
vis={
Object {
"serialize": [MockFunction],
"setState": [MockFunction],
"type": Object {
"schemas": Object {
@ -169,6 +171,7 @@ exports[`MetricsAxisOptions component should init with the default set of props
setCategoryAxis={[Function]}
vis={
Object {
"serialize": [MockFunction],
"setState": [MockFunction],
"type": Object {
"schemas": Object {

View file

@ -95,6 +95,7 @@ describe('MetricsAxisOptions component', () => {
schemas: { metrics: [{ name: 'metric' }] },
},
setState: jest.fn(),
serialize: jest.fn(),
},
stateParams: {
valueAxes: [axis],

View file

@ -299,7 +299,7 @@ function MetricsAxisOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
}, [stateParams.seriesParams]);
useEffect(() => {
vis.setState({ type: visType } as any);
vis.setState({ ...vis.serialize(), type: visType });
}, [vis, visType]);
return isTabSelected ? (