1212 class =" full-width full-height bg-transparent carousel-height"
1313 >
1414 <q-carousel-slide
15- v-for =" ( chartComponent, index) in chartCarouselItems"
16- :key =" index "
15+ v-for =" chartComponent in chartCarouselItems"
16+ :key =" `${chartComponent.name}-${chartComponent.name === 'HistoryChart' ? renderKey : 0}` "
1717 :name =" chartComponent.name"
1818 >
1919 <component :is =" chartComponent.component" :show-legend =" legendVisible" />
4242</template >
4343
4444<script setup lang="ts">
45- import { ref , computed } from ' vue' ;
45+ import { ref , computed , watch } from ' vue' ;
4646import { useQuasar } from ' quasar' ;
4747import EnergyFlowChart from ' ./charts/energyFlowChart/EnergyFlowChart.vue' ;
4848import HistoryChart from ' ./charts/historyChart/HistoryChart.vue' ;
@@ -53,7 +53,7 @@ defineOptions({
5353});
5454const $q = useQuasar ();
5555const localDataStore = useLocalDataStore ();
56-
56+ const renderKey = ref ( 0 );
5757const toggleLegend = () => {
5858 localDataStore .toggleLegendVisibility ();
5959};
@@ -70,6 +70,21 @@ const chartCarouselItems = [
7070 },
7171];
7272const currentSlide = ref <string >(chartCarouselItems [0 ].name );
73+
74+ watch (
75+ () => fullscreen .value ,
76+ (isFullscreen , wasFullscreen ) => {
77+ // Only trigger when exiting fullscreen and current slide is HistoryChart
78+ if (
79+ ! isFullscreen &&
80+ wasFullscreen &&
81+ currentSlide .value === ' HistoryChart'
82+ ) {
83+ // Force the chart to be recreated by changing its key
84+ renderKey .value ++ ;
85+ }
86+ },
87+ );
7388 </script >
7489
7590<style scoped>
0 commit comments