Skip to content

Commit 40ae369

Browse files
authored
Merge pull request #430 from AppQuality/UN-511-move-empty-state-before-tables
fix: Render empty state before excuting table hooks if no bugs
2 parents 8fb7ee6 + 6bb2a65 commit 40ae369

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/pages/Bugs/BugsTable/AllBugs.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
selectBug,
88
} from 'src/features/bugsPage/bugsPageSlice';
99
import { TableBugType } from '../types';
10-
import { EmptyState } from './components/EmptyState';
1110
import { InfoRow } from './components/InfoRow';
1211
import { mapBugsToTableData } from './utils/mapBugsToTableData';
1312
import { useTableColumns } from './hooks/useTableColumns';
@@ -18,10 +17,6 @@ export const AllBugs = ({ bugs }: { bugs: TableBugType[] }) => {
1817
const { columns } = useTableColumns();
1918
const dispatch = useAppDispatch();
2019

21-
if (!bugs.length) {
22-
return <EmptyState />;
23-
}
24-
2520
return (
2621
<div>
2722
<InfoRow bugs={bugs} />

src/pages/Bugs/BugsTable/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useAppSelector } from 'src/app/hooks';
22
import { AllBugs } from './AllBugs';
33
import { BugsBySeverity } from './BugsBySeverity';
44
import { BugsByUsecase } from './BugsByUsecase';
5+
import { EmptyState } from './components/EmptyState';
56
import { LoadingState } from './components/LoadingState';
67
import { useTableData } from './hooks/useTableData';
78

@@ -13,6 +14,10 @@ const BugsTable = ({ campaignId }: { campaignId: number }) => {
1314
return <LoadingState />;
1415
}
1516

17+
if (!data.allBugs.length) {
18+
return <EmptyState />;
19+
}
20+
1621
return (
1722
<div>
1823
{pageView === 'byUsecase' && (

0 commit comments

Comments
 (0)