File tree Expand file tree Collapse file tree
src/authz-module/libraries-manager/components/TeamTable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,7 @@ const SortDropdown: FC = () => {
3535 const SORT_LABELS : Record < string , string > = useMemo ( ( ) => ( {
3636 'name-a-z' : intl . formatMessage ( { id : 'authz.libraries.team.table.sort.name-a-z' , defaultMessage : 'Name A-Z' } ) ,
3737 'name-z-a' : intl . formatMessage ( { id : 'authz.libraries.team.table.sort.name-z-a' , defaultMessage : 'Name Z-A' } ) ,
38- // eslint-disable-next-line react-hooks/exhaustive-deps
39- } ) , [ ] ) ;
38+ } ) , [ intl ] ) ;
4039
4140 const currentSort = useMemo ( ( ) => {
4241 if ( ! state ?. sortBy ?. length ) { return undefined ; }
@@ -63,8 +62,7 @@ const SortDropdown: FC = () => {
6362 ...option ,
6463 label : SORT_LABELS [ key ] ,
6564 } ) ) ,
66- // eslint-disable-next-line react-hooks/exhaustive-deps
67- [ ] ,
65+ [ SORT_LABELS ] ,
6866 ) ;
6967
7068 const currentSortLabel = sortOrder ? SORT_LABELS [ sortOrder ] : 'Sort' ;
Original file line number Diff line number Diff line change 1- import { useMemo } from 'react' ;
1+ import { useEffect , useMemo } from 'react' ;
22import { useNavigate } from 'react-router-dom' ;
33import debounce from 'lodash.debounce' ;
44import { useIntl } from '@edx/frontend-platform/i18n' ;
@@ -80,6 +80,10 @@ const TeamTable = () => {
8080 [ roles ] ,
8181 ) ;
8282
83+ const fetchData = useMemo ( ( ) => debounce ( handleTableFetch , 500 ) , [ handleTableFetch ] ) ;
84+
85+ useEffect ( ( ) => ( ) => fetchData . cancel ( ) , [ fetchData ] ) ;
86+
8387 return (
8488 < DataTable
8589 isFilterable
@@ -90,7 +94,7 @@ const TeamTable = () => {
9094 manualSortBy
9195 defaultColumnValues = { { Filter : TextFilter } }
9296 numBreakoutFilters = { 3 }
93- fetchData = { debounce ( handleTableFetch , 1000 ) }
97+ fetchData = { fetchData }
9498 data = { rows }
9599 itemCount = { teamMembers ?. count || 0 }
96100 pageCount = { pageCount }
You can’t perform that action at this time.
0 commit comments