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

Commit

Permalink
refactor: add a static on the function for better id of comp type
Browse files Browse the repository at this point in the history
  • Loading branch information
benox3 committed May 7, 2019
1 parent 4c76ec2 commit 4524518
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/DataScroller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/components/Column/Column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 3 additions & 0 deletions src/components/Group/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 4524518

Please sign in to comment.