Skip to content

Commit

Permalink
Use a forwardRef-less Row component internally by default (#2640)
Browse files Browse the repository at this point in the history
* Use a forwardRef-less Row component internally by default

* Pin node in CI
  • Loading branch information
nstepien authored Sep 8, 2021
1 parent dd90b9c commit af0848a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
node-version: '16.8'
check-latest: true
- uses: actions/cache@v2
with:
Expand Down
4 changes: 3 additions & 1 deletion src/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ function Row<R, SR>(
);
}

export default memo(forwardRef(Row)) as <R, SR>(
export default memo(Row) as <R, SR>(props: RowRendererProps<R, SR>) => JSX.Element;

export const RowWithRef = memo(forwardRef(Row)) as <R, SR>(
props: RowRendererProps<R, SR> & RefAttributes<HTMLDivElement>
) => JSX.Element;
2 changes: 1 addition & 1 deletion src/hooks/useCombinedRefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function useCombinedRefs<T>(...refs: readonly React.Ref<T>[]) {
for (const ref of refs) {
if (typeof ref === 'function') {
ref(handle);
} else if (ref !== null) {
} else if (ref !== null && 'current' in ref) {
// @ts-expect-error: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065
ref.current = handle;
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { default } from './DataGrid';
export type { DataGridProps, DataGridHandle } from './DataGrid';
export { default as Row } from './Row';
export { RowWithRef as Row } from './Row';
export * from './Columns';
export * from './formatters';
export { default as TextEditor } from './editors/TextEditor';
Expand Down

0 comments on commit af0848a

Please sign in to comment.