Skip to content

Commit

Permalink
chore: add process.env.NODE_ENV (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan authored Jan 18, 2024
1 parent 9e047d5 commit 5926b1c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/Body/BodyRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
);
}

BodyRow.displayName = 'BodyRow';
if (process.env.NODE_ENV !== 'production') {
BodyRow.displayName = 'BodyRow';
}

export default responseImmutable(BodyRow);
4 changes: 3 additions & 1 deletion src/Body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ function Body<RecordType>(props: BodyProps<RecordType>) {
);
}

Body.displayName = 'Body';
if (process.env.NODE_ENV !== 'production') {
Body.displayName = 'Body';
}

export default responseImmutable(Body);
4 changes: 3 additions & 1 deletion src/FixedHolder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<unknown>>(
);
});

FixedHolder.displayName = 'FixedHolder';
if (process.env.NODE_ENV !== 'production') {
FixedHolder.displayName = 'FixedHolder';
}

/** Return a table in div as fixed element which contains sticky info */
// export default responseImmutable(FixedHolder);
Expand Down
6 changes: 4 additions & 2 deletions src/Header/HeaderRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function HeaderRow<RecordType>({
flattenColumns,
stickyOffsets,
direction,
column
column,
);

let additionalProps: React.HTMLAttributes<HTMLElement>;
Expand All @@ -81,6 +81,8 @@ function HeaderRow<RecordType>({
);
}

HeaderRow.displayName = 'HeaderRow';
if (process.env.NODE_ENV !== 'production') {
HeaderRow.displayName = 'HeaderRow';
}

export default HeaderRow;
6 changes: 2 additions & 4 deletions src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,8 @@ function Table<RecordType extends DefaultRecordType>(
}

export type ForwardGenericTable = (<RecordType extends DefaultRecordType = any>(
props: TableProps<RecordType> & { ref?: React.Ref<Reference> },
) => React.ReactElement) & {
displayName?: string;
};
props: TableProps<RecordType> & React.RefAttributes<Reference>,
) => React.ReactElement) & { displayName?: string };

const RefTable = React.forwardRef(Table) as ForwardGenericTable;

Expand Down
6 changes: 2 additions & 4 deletions src/VirtualTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ function VirtualTable<RecordType>(props: VirtualTableProps<RecordType>, ref: Rea
}

export type ForwardGenericVirtualTable = (<RecordType>(
props: TableProps<RecordType> & { ref?: React.Ref<Reference> },
) => React.ReactElement) & {
displayName?: string;
};
props: TableProps<RecordType> & React.RefAttributes<Reference>,
) => React.ReactElement) & { displayName?: string };

const RefVirtualTable = React.forwardRef(VirtualTable) as ForwardGenericVirtualTable;

Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useRenderTimes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ export const RenderBlock = React.memo(() => {
const times = useRenderTimes();
return <h1>Render Times: {times}</h1>;
});
RenderBlock.displayName = 'RenderBlock';

if (process.env.NODE_ENV !== 'production') {
RenderBlock.displayName = 'RenderBlock';
}
2 changes: 1 addition & 1 deletion tests/Virtual.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Table.Virtual', () => {
});
}

function getTable(props?: Partial<VirtualTableProps<any>> & { ref?: React.Ref<Reference> }) {
function getTable(props?: Partial<VirtualTableProps<any>> & React.RefAttributes<Reference>) {
return render(
<VirtualTable
columns={[
Expand Down

1 comment on commit 5926b1c

@vercel
Copy link

@vercel vercel bot commented on 5926b1c Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

table – ./

table-git-master-react-component.vercel.app
table-react-component.vercel.app

Please sign in to comment.