@@ -18,11 +18,10 @@ import { FastboardGroupChartProperties } from "@/types/editor/group-chart-types"
18
18
import useData from "@/hooks/useData" ;
19
19
import { ComponentId , ComponentType } from "@/types/editor" ;
20
20
import { useEffect } from "react" ;
21
- import { useSetRecoilState } from "recoil" ;
21
+ import { useRecoilValue , useSetRecoilState } from "recoil" ;
22
22
import { propertiesDrawerState } from "@/atoms/editor" ;
23
23
import { useTheme } from "next-themes" ;
24
24
import { generatePalette } from "@/lib/colors" ;
25
- import { Card } from "@nextui-org/react" ;
26
25
27
26
const groupData = ( data : any [ ] , groupBy : string ) => {
28
27
return data . reduce ( ( acc , item ) => {
@@ -197,8 +196,6 @@ const FastboardGroupChart = ({
197
196
properties,
198
197
} : {
199
198
id : ComponentId ;
200
- layoutIndex ?: number ;
201
- container ?: string ;
202
199
properties : FastboardGroupChartProperties ;
203
200
} ) => {
204
201
const { theme } = useTheme ( ) ;
@@ -213,6 +210,9 @@ const FastboardGroupChart = ({
213
210
layout,
214
211
} = properties ;
215
212
const setProperties = useSetRecoilState ( propertiesDrawerState ) ;
213
+ const propertiesDrawer = useRecoilValue ( propertiesDrawerState ) ;
214
+
215
+ const isSelected = propertiesDrawer . selectedComponentId === id ;
216
216
217
217
const {
218
218
data,
@@ -222,7 +222,7 @@ const FastboardGroupChart = ({
222
222
} = useData ( `${ ComponentType . GroupChart } -${ id } ` , sourceQueryData ) ;
223
223
224
224
useEffect ( ( ) => {
225
- if ( keys ) {
225
+ if ( keys && isSelected ) {
226
226
setProperties ( ( prev ) => {
227
227
return {
228
228
...prev ,
@@ -233,7 +233,7 @@ const FastboardGroupChart = ({
233
233
} ;
234
234
} ) ;
235
235
}
236
- } , [ keys ] ) ;
236
+ } , [ keys , isSelected ] ) ;
237
237
238
238
const chartConfig = {
239
239
[ groupBy ] : {
0 commit comments