massucattoj commented on code in PR #37164:
URL: https://github.com/apache/superset/pull/37164#discussion_r2714743557
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts:
##########
@@ -445,67 +445,86 @@ export function transformIntervalAnnotation(
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
+ if (annotations.length === 0) {
+ return series;
+ }
+
+ const { name, color, opacity, showLabel } = layer;
+ const isHorizontal = orientation === OrientationType.Horizontal;
+
+ const intervalsByStartTime = new Map<string, string[]>();
annotations.forEach(annotation => {
- const { name, color, opacity, showLabel } = layer;
- const { descriptions, intervalEnd, time, title } = annotation;
+ const { descriptions, time = '', title } = annotation;
Review Comment:
It's more a ts type safety.
The Annotation type in @superset-ui/core defines time as optional. The
initialization is redundant at runtime, but necessary to satisfy TypeScript's
type checker. It's a workaround for a mismatch between the type definition and
the actual implementation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]