Skip to content

Commit f3c1776

Browse files
Fix table with null text (#1609)
* Handle null values in table text * Add test case for null value in table text * Update CHANGELOG.md
1 parent e016c22 commit f3c1776

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Unreleased
44

5+
- Fix null values in table cells rendering as `[object Object]`
6+
57
### [v0.17.0] - 2025-04-12
68

79
- Fix precision rounding issues in LineWrapper

lib/table/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export function deepMerge(target, ...sources) {
360360

361361
function deepClone(obj) {
362362
let result = obj;
363-
if (typeof obj == 'object') {
363+
if (obj && typeof obj == 'object') {
364364
result = Array.isArray(obj) ? [] : {};
365365
for (const key in obj) result[key] = deepClone(obj[key]);
366366
}

tests/unit/table.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('utils', () => {
2323
[{ a: 'hello' }, { a: 'world' }, { a: 'world' }],
2424
[{}, { a: 'hello' }, { a: 'hello' }],
2525
[{ a: 'hello' }, undefined, { a: 'hello' }],
26-
[undefined, undefined, undefined],
26+
[undefined, null, undefined],
2727
[1, 2, 1],
2828
[1, {}, 1],
2929
[{ a: 'hello' }, { a: {} }, { a: 'hello' }],

0 commit comments

Comments
 (0)