Skip to content

Commit

Permalink
fix: JSON.stringify 处理有循环依赖的对象会报错
Browse files Browse the repository at this point in the history
  • Loading branch information
purple-force authored Jan 7, 2025
1 parent 6936c2b commit 82a0f44
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ export function isColHidden(col: ResizableColumnType) {
// Table.SELECTION_COLUMN 和 Table.EXPANDABLE_COLUMN 为 {},会被过滤掉,需要保留
// 因 Antd 侧只想用 Table.SELECTION_COLUMN 和 Table.EXPANDABLE_COLUMN 的引用值是否相等来判断是否为内置列
// 而当组件和业务的 Table 不是同一个引用时,只通过引用值判断会导致内置列被过滤掉
// 故采用 JSON.stringify 判断是否为内置列
// fix #107
export function isReservedColumn(item: ResizableColumnType) {
return JSON.stringify(item) === '{}'
return item && item.constructor === Object && Object.keys(item).length === 0
}

0 comments on commit 82a0f44

Please sign in to comment.