diff --git a/src/DataScroller.tsx b/src/DataScroller.tsx index 323b8a21..5f6bd880 100644 --- a/src/DataScroller.tsx +++ b/src/DataScroller.tsx @@ -23,10 +23,8 @@ const getColumns = (node: React.ReactNode) => { if ( column.props && - (column.type === Column || - // This is necessary for HMR - // @ts-ignore - column.type.displayName === 'Column') + // @ts-ignore + column.type.__Column__ ) { return [...acc, column.props]; } @@ -67,10 +65,8 @@ const getColumnsAndGroups = ( } if ( - elementChild.type === Group || - // This is necessary for HMR // @ts-ignore - elementChild.type.displayName === 'Group' + elementChild.type.__Group__ ) { return { ...acc, diff --git a/src/components/Column/Column.tsx b/src/components/Column/Column.tsx index 4ed979cd..cd36c81b 100644 --- a/src/components/Column/Column.tsx +++ b/src/components/Column/Column.tsx @@ -13,3 +13,6 @@ export type Props = { export default function Column(props: Props) { return null; } + +// Used for identifying the component type when iterating through children +Column.__Column__ = true; diff --git a/src/components/Group/Group.tsx b/src/components/Group/Group.tsx index f46eecc4..14981a83 100644 --- a/src/components/Group/Group.tsx +++ b/src/components/Group/Group.tsx @@ -10,3 +10,6 @@ export type Props = { export default function Group({ children, headerRenderer, groupData }: Props) { return null; } + +// Used for identifying the component type when iterating through children +Group.__Group__ = true;