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>({
4242 const attributeMenuRef = useRef < HTMLDivElement > ( null ) ;
4343 const attributeContainerRef = useRef < HTMLDivElement > ( null ) ;
4444
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+
4551 const filterItems : DataViewFilterIdentifiers [ ] = useMemo ( ( ) => React . Children . toArray ( children )
4652 . map ( child =>
4753 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
4955
5056 useEffect ( ( ) => {
5157 filterItems . length > 0 && setActiveAttributeMenu ( filterItems [ 0 ] . title ) ;
You can’t perform that action at this time.
0 commit comments