1- import * as React from 'react' ;
21import {
32 TopToolbar ,
43 ExportButton ,
@@ -13,35 +12,25 @@ import {
1312
1413import { ImageList } from './GridList' ;
1514import { CompanyListFilter } from './CompanyListFilter' ;
16- import { LinearProgress , Stack } from '@mui/material' ;
15+ import { Stack } from '@mui/material' ;
1716import { CompanyEmpty } from './CompanyEmpty' ;
18- import { hasOtherFiltersThanDefault } from '../misc/hasOtherFiltersThanDefault' ;
1917
2018export const CompanyList = ( ) => {
2119 const { identity } = useGetIdentity ( ) ;
2220 if ( ! identity ) return null ;
2321 return (
24- < ListBase
25- perPage = { 25 }
26- filterDefaultValues = { { sales_id : identity ?. id } }
27- sort = { { field : 'name' , order : 'ASC' } }
28- >
22+ < ListBase perPage = { 25 } sort = { { field : 'name' , order : 'ASC' } } >
2923 < CompanyListLayout />
3024 </ ListBase >
3125 ) ;
3226} ;
3327
3428const CompanyListLayout = ( ) => {
3529 const { data, isPending, filterValues } = useListContext ( ) ;
36- const { identity } = useGetIdentity ( ) ;
37- const hasOtherFiltersThanDefaultBoolean = hasOtherFiltersThanDefault (
38- filterValues ,
39- 'sales_id' ,
40- identity ?. id
41- ) ;
42- if ( isPending ) return < LinearProgress /> ;
43- if ( ! data ?. length && ! hasOtherFiltersThanDefaultBoolean )
44- return < CompanyEmpty /> ;
30+ const hasFilters = filterValues && Object . keys ( filterValues ) . length > 0 ;
31+
32+ if ( isPending ) return null ;
33+ if ( ! data ?. length && ! hasFilters ) return < CompanyEmpty /> ;
4534
4635 return (
4736 < Stack direction = "row" component = "div" >
0 commit comments