File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useEffect } from 'react' ;
1+ import { useEffect , useMemo } from 'react' ;
22import { LoadingSpinner } from '../generic/Loading' ;
33import { useSearchContext } from '../search-manager' ;
44import { NoComponents , NoSearchResults } from './EmptyStates' ;
@@ -50,9 +50,12 @@ const LibraryContent = ({ contentType = ContentType.home }: LibraryContentProps)
5050 * selection workflow when adding components to xblocks by choosing the whole collection in Collections tab.
5151 * Note: LibraryAuthoringPage.tsx has been modified to skip backend filtering for this purpose.
5252 */
53- const filteredHits = contentType === ContentType . collections
54- ? hits . filter ( ( hit ) => hit . type === 'collection' )
55- : hits ;
53+ const filteredHits = useMemo (
54+ ( ) => ( contentType === ContentType . collections
55+ ? hits . filter ( ( hit ) => hit . type === 'collection' )
56+ : hits ) ,
57+ [ hits , contentType ] ,
58+ ) ;
5659
5760 useEffect ( ( ) => {
5861 if ( usageKey ) {
You can’t perform that action at this time.
0 commit comments