Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 4524518

Browse files
committed
refactor: add a static on the function for better id of comp type
1 parent 4c76ec2 commit 4524518

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/DataScroller.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ const getColumns = (node: React.ReactNode) => {
2323

2424
if (
2525
column.props &&
26-
(column.type === Column ||
27-
// This is necessary for HMR
28-
// @ts-ignore
29-
column.type.displayName === 'Column')
26+
// @ts-ignore
27+
column.type.__Column__
3028
) {
3129
return [...acc, column.props];
3230
}
@@ -67,10 +65,8 @@ const getColumnsAndGroups = (
6765
}
6866

6967
if (
70-
elementChild.type === Group ||
71-
// This is necessary for HMR
7268
// @ts-ignore
73-
elementChild.type.displayName === 'Group'
69+
elementChild.type.__Group__
7470
) {
7571
return {
7672
...acc,

src/components/Column/Column.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ export type Props = {
1313
export default function Column(props: Props) {
1414
return null;
1515
}
16+
17+
// Used for identifying the component type when iterating through children
18+
Column.__Column__ = true;

src/components/Group/Group.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ export type Props = {
1010
export default function Group({ children, headerRenderer, groupData }: Props) {
1111
return null;
1212
}
13+
14+
// Used for identifying the component type when iterating through children
15+
Group.__Group__ = true;

0 commit comments

Comments
 (0)