File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
packages/module/src/DataViewFilters Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,16 @@ export const DataViewFilters = <T extends object>({
42
42
const attributeMenuRef = useRef < HTMLDivElement > ( null ) ;
43
43
const attributeContainerRef = useRef < HTMLDivElement > ( null ) ;
44
44
45
+ const childrenHash = useMemo ( ( ) => JSON . stringify (
46
+ React . Children . map ( children , ( child ) =>
47
+ React . isValidElement ( child ) ? { type : child . type , key : child . key , props : child . props } : child
48
+ )
49
+ ) , [ children ] ) ;
50
+
45
51
const filterItems : DataViewFilterIdentifiers [ ] = useMemo ( ( ) => React . Children . toArray ( children )
46
52
. map ( child =>
47
53
React . isValidElement ( child ) ? { filterId : String ( child . props . filterId ) , title : String ( child . props . title ) } : undefined
48
- ) . filter ( ( item ) : item is DataViewFilterIdentifiers => ! ! item ) , [ ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
54
+ ) . filter ( ( item ) : item is DataViewFilterIdentifiers => ! ! item ) , [ childrenHash ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
49
55
50
56
useEffect ( ( ) => {
51
57
filterItems . length > 0 && setActiveAttributeMenu ( filterItems [ 0 ] . title ) ;
You can’t perform that action at this time.
0 commit comments