Skip to content

Commit 15b732d

Browse files
authored
fix: forecast default to empty array (#25177)
1 parent 522caa3 commit 15b732d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

assets/js/components/Forecast/Chart.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export default defineComponent({
163163
order: active ? 0 : 1,
164164
});
165165
}
166-
if (this.gridSlots.length > 0) {
166+
if (this.gridSlots && this.gridSlots.length > 0) {
167167
const active = this.selected === ForecastType.Price;
168168
const color = active ? colors.price : colors.border;
169169
datasets.push({
@@ -184,7 +184,7 @@ export default defineComponent({
184184
order: active ? 0 : 1,
185185
});
186186
}
187-
if (this.co2Slots.length > 0) {
187+
if (this.co2Slots && this.co2Slots.length > 0) {
188188
const active = this.selected === ForecastType.Co2;
189189
const color = active ? colors.co2 : colors.border;
190190
datasets.push({
@@ -427,6 +427,10 @@ export default defineComponent({
427427
this.startDate = now;
428428
},
429429
filterSlots(slots: ForecastSlot[] = []) {
430+
if (!slots) {
431+
return undefined;
432+
}
433+
430434
return slots.filter(
431435
(slot) =>
432436
new Date(slot.end) >= this.startDate && new Date(slot.start) <= this.endDate

0 commit comments

Comments
 (0)