Skip to content

Commit 361dedd

Browse files
authored
Merge pull request #2391 from JohnDuprey/dev
Update CellTable.jsx
2 parents def6083 + a3675bd commit 361dedd

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/components/tables/CellTable.jsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,24 @@ export default function cellTable(
2020
columnProp = column
2121
}
2222

23-
if (!Array.isArray(columnProp) && typeof columnProp === 'object') {
24-
columnProp = Object.keys(columnProp).map((key) => {
25-
return {
26-
Key: key,
27-
Value: columnProp[key],
28-
}
29-
})
23+
if (columnProp === undefined || columnProp === null) {
24+
columnProp = []
3025
} else {
31-
if (Array.isArray(columnProp) && typeof columnProp[0] !== 'object') {
32-
columnProp = columnProp.map((row) => {
26+
if (!Array.isArray(columnProp) && typeof columnProp === 'object') {
27+
columnProp = Object.keys(columnProp).map((key) => {
3328
return {
34-
Value: row,
29+
Key: key,
30+
Value: columnProp[key],
3531
}
3632
})
33+
} else {
34+
if (Array.isArray(columnProp) && typeof columnProp[0] !== 'object') {
35+
columnProp = columnProp.map((row) => {
36+
return {
37+
Value: row,
38+
}
39+
})
40+
}
3741
}
3842
}
3943

0 commit comments

Comments
 (0)