From 5ec603767da22fe6cf2820536687aa77013436cc Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Thu, 30 Dec 2021 13:57:46 +0100 Subject: [PATCH] fix(flamegraph): solve animation regression occurring with 6db2677 (#1541) Mandatory nature of the internal `animation` property is restored, and the `animation: {duration}` in the chart specification API reaches the render code again fix #1540 --- .../chart_types/partition_chart/layout/types/config_types.ts | 2 +- .../chart_types/partition_chart/layout/types/viewmodel_types.ts | 1 + .../chart_types/partition_chart/layout/viewmodel/viewmodel.ts | 2 ++ packages/charts/src/chart_types/partition_chart/specs/index.ts | 2 ++ packages/charts/src/mocks/specs/specs.ts | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/charts/src/chart_types/partition_chart/layout/types/config_types.ts b/packages/charts/src/chart_types/partition_chart/layout/types/config_types.ts index 28812caba1..7a68f8fb16 100644 --- a/packages/charts/src/chart_types/partition_chart/layout/types/config_types.ts +++ b/packages/charts/src/chart_types/partition_chart/layout/types/config_types.ts @@ -36,7 +36,7 @@ export interface AnimKeyframe { /** @public */ export interface AnimationConfig { /** @alpha */ - animation?: { + animation: { duration: TimeMs; keyframes?: Array; }; diff --git a/packages/charts/src/chart_types/partition_chart/layout/types/viewmodel_types.ts b/packages/charts/src/chart_types/partition_chart/layout/types/viewmodel_types.ts index 152008f094..e490154e15 100644 --- a/packages/charts/src/chart_types/partition_chart/layout/types/viewmodel_types.ts +++ b/packages/charts/src/chart_types/partition_chart/layout/types/viewmodel_types.ts @@ -208,6 +208,7 @@ export const nullShapeViewModel = ( width: 0, height: 0, }, + animation: { duration: 0 }, }); /** @internal */ diff --git a/packages/charts/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts b/packages/charts/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts index 10bec313cc..28f0794074 100644 --- a/packages/charts/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts +++ b/packages/charts/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts @@ -309,6 +309,7 @@ export function shapeViewModel( clockwiseSectors, maxRowCount, specialFirstInnermostSector, + animation, } = spec; const { emptySizeRatio, @@ -511,6 +512,7 @@ export function shapeViewModel( pickQuads, outerRadius, chartDimensions, + animation, }; } diff --git a/packages/charts/src/chart_types/partition_chart/specs/index.ts b/packages/charts/src/chart_types/partition_chart/specs/index.ts index 6277c0fbbf..89c4d5ea38 100644 --- a/packages/charts/src/chart_types/partition_chart/specs/index.ts +++ b/packages/charts/src/chart_types/partition_chart/specs/index.ts @@ -68,6 +68,7 @@ const defaultProps = { radiusOutside: 128, fillRectangleWidth: Infinity, fillRectangleHeight: Infinity, + animation: { duration: 0 }, }; /** @@ -128,5 +129,6 @@ export const Partition: React.FunctionComponent(defaultProps), ); diff --git a/packages/charts/src/mocks/specs/specs.ts b/packages/charts/src/mocks/specs/specs.ts index 552634101e..4ed87bc345 100644 --- a/packages/charts/src/mocks/specs/specs.ts +++ b/packages/charts/src/mocks/specs/specs.ts @@ -147,6 +147,7 @@ export class MockSeriesSpec { fillLabel: {}, }, ], + animation: { duration: 0 }, data: [], }; @@ -177,6 +178,7 @@ export class MockSeriesSpec { fillLabel: {}, }, ], + animation: { duration: 0 }, data: [], };