Skip to content

Commit 20d2af7

Browse files
authored
Merge pull request #377 from AppQuality/fix-device-chart
fix(campaign): Prevent removal of inner slice in device widget when there is only one device
2 parents dce73e9 + c3f1ff1 commit 20d2af7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/pages/Campaign/widgets/TotalBugsByOsAndDevices/ChartTotalBugsByDevice/useBugsByDevices.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,18 @@ const useBugsByDevices = (campaignId: number) => {
8585
}, [data]);
8686

8787
// If there is only one type of device, remove the first level
88-
if (chartData.children && chartData.children.length === 1) {
88+
if (
89+
chartData.children &&
90+
chartData.children.length === 1 &&
91+
chartData.children[0].children
92+
) {
8993
chartData.children = chartData.children[0].children;
9094
// If there is only one OS, remove the second level
91-
if (chartData.children && chartData.children.length === 1) {
95+
if (
96+
chartData.children &&
97+
chartData.children.length === 1 &&
98+
chartData.children[0].children
99+
) {
92100
chartData.children = chartData.children[0].children;
93101
}
94102
}

0 commit comments

Comments
 (0)