Skip to content

Commit 2bb14b9

Browse files
committed
Fix double progress while loading
1 parent 2ec66ee commit 2bb14b9

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

examples/crm/src/companies/CompanyList.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from 'react';
21
import {
32
TopToolbar,
43
ExportButton,
@@ -13,7 +12,7 @@ import {
1312

1413
import { ImageList } from './GridList';
1514
import { CompanyListFilter } from './CompanyListFilter';
16-
import { LinearProgress, Stack } from '@mui/material';
15+
import { Stack } from '@mui/material';
1716
import { CompanyEmpty } from './CompanyEmpty';
1817

1918
export const CompanyList = () => {
@@ -30,7 +29,7 @@ const CompanyListLayout = () => {
3029
const { data, isPending, filterValues } = useListContext();
3130
const hasFilters = filterValues && Object.keys(filterValues).length > 0;
3231

33-
if (isPending) return <LinearProgress />;
32+
if (isPending) return null;
3433
if (!data?.length && !hasFilters) return <CompanyEmpty />;
3534

3635
return (

examples/crm/src/contacts/ContactList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable import/no-anonymous-default-export */
2-
import { Card, LinearProgress, Stack } from '@mui/material';
2+
import { Card, Stack } from '@mui/material';
33
import jsonExport from 'jsonexport/dist';
44
import type { Exporter, Identifier, RaRecord } from 'react-admin';
55
import {
@@ -17,6 +17,7 @@ import {
1717
useGetIdentity,
1818
useListContext,
1919
} from 'react-admin';
20+
2021
import { Company, Contact, Sale, Tag } from '../types';
2122
import { ContactEmpty } from './ContactEmpty';
2223
import { ContactImportButton } from './ContactImportButton';
@@ -45,8 +46,7 @@ const ContactListLayout = () => {
4546

4647
const hasFilters = filterValues && Object.keys(filterValues).length > 0;
4748

48-
if (!identity) return null;
49-
if (isPending) return <LinearProgress />;
49+
if (!identity || isPending) return null;
5050

5151
if (!data?.length && !hasFilters) return <ContactEmpty />;
5252

examples/crm/src/deals/DealList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from 'react-admin';
1515
import { matchPath, useLocation } from 'react-router';
1616

17-
import { Card, LinearProgress, Stack } from '@mui/material';
17+
import { Card, Stack } from '@mui/material';
1818
import { useConfigurationContext } from '../root/ConfigurationContext';
1919
import { DealArchivedList } from './DealArchivedList';
2020
import { DealCreate } from './DealCreate';
@@ -63,7 +63,7 @@ const DealLayout = () => {
6363
const { data, isPending, filterValues } = useListContext();
6464
const hasFilters = filterValues && Object.keys(filterValues).length > 0;
6565

66-
if (isPending) return <LinearProgress />;
66+
if (isPending) return null;
6767
if (!data?.length && !hasFilters)
6868
return (
6969
<>

examples/crm/src/layout/Layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { Suspense, ReactNode } from 'react';
22
import { CssBaseline, Container } from '@mui/material';
3-
import { CheckForApplicationUpdate } from 'react-admin';
3+
import { Error, Loading, CheckForApplicationUpdate } from 'react-admin';
44
import { ErrorBoundary } from 'react-error-boundary';
55

6-
import { Error, Loading } from 'react-admin';
76
import Header from './Header';
87

98
const Layout = ({ children }: { children: ReactNode }) => (

0 commit comments

Comments
 (0)