File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react"
2
+ import { useEffect , useState } from "react"
2
3
import {
3
4
BarElement ,
4
5
CategoryScale ,
@@ -38,6 +39,16 @@ const EnergyConsumptionChart = () => {
38
39
const { locale } = useRouter ( )
39
40
const isRtl = isLangRightToLeft ( locale as Lang )
40
41
42
+ const useIsClient = ( ) => {
43
+ const [ isClient , setClient ] = useState ( false )
44
+
45
+ useEffect ( ( ) => {
46
+ setClient ( true )
47
+ } , [ ] )
48
+
49
+ return isClient
50
+ }
51
+
41
52
// chart rawData, according to different breakpoints
42
53
const rawData = useBreakpointValue ( {
43
54
base : [
@@ -240,7 +251,9 @@ const EnergyConsumptionChart = () => {
240
251
mb = { { base : 4 , md : 0 } }
241
252
>
242
253
{ /* TODO: isRtl ? data?.reverse() : data */ }
243
- < Bar options = { chartOptions } data = { chartData } updateMode = "none" />
254
+ { useIsClient ( ) && (
255
+ < Bar options = { chartOptions } data = { chartData } updateMode = "none" />
256
+ ) }
244
257
</ Box >
245
258
</ Center >
246
259
You can’t perform that action at this time.
0 commit comments