Skip to content

Commit 9b7add3

Browse files
authored
Energyflow UI: first load stability (#28401)
1 parent 8f2a6f0 commit 9b7add3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

assets/js/components/Energyflow/Visualization.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div
33
data-testid="visualization"
44
class="visualization"
5-
:class="{ 'visualization--ready': visualizationReady }"
5+
:class="{ 'visualization--ready': transitionsEnabled }"
66
>
77
<div class="label-scale d-flex">
88
<div class="d-flex justify-content-start flex-grow-1">
@@ -140,7 +140,7 @@ export default defineComponent({
140140
outPower: { type: Number, default: 0 },
141141
},
142142
data() {
143-
return { width: 0 };
143+
return { width: 0, transitionsEnabled: false };
144144
},
145145
computed: {
146146
gridExport() {
@@ -189,6 +189,18 @@ export default defineComponent({
189189
},
190190
},
191191
192+
watch: {
193+
visualizationReady(newVal: boolean) {
194+
if (newVal && !this.transitionsEnabled) {
195+
// ensure screen is drawn before enabling transitions
196+
requestAnimationFrame(() => {
197+
requestAnimationFrame(() => {
198+
this.transitionsEnabled = true;
199+
});
200+
});
201+
}
202+
},
203+
},
192204
mounted() {
193205
this.$nextTick(function () {
194206
window.addEventListener("resize", this.updateElementWidth);
@@ -321,6 +333,8 @@ html.dark .grid-import {
321333
right: -0.25rem;
322334
color: var(--evcc-gray);
323335
opacity: 0;
336+
}
337+
.visualization--ready .battery-hold {
324338
transition-property: opacity;
325339
transition-duration: var(--evcc-transition-medium);
326340
transition-timing-function: linear;

0 commit comments

Comments
 (0)