Skip to content

Commit c528a38

Browse files
Use forwardRef for DataGridRow
1 parent 48f719f commit c528a38

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

extensions/ql-vscode/src/view/common/DataGrid.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from "react";
2+
import { forwardRef } from "react";
23
import { styled } from "styled-components";
34

45
/*
@@ -50,22 +51,24 @@ const StyledDataGridRow = styled.div<{ $focused?: boolean }>`
5051
interface DataGridRowProps {
5152
focused?: boolean;
5253
children: React.ReactNode;
53-
ref?: React.Ref<HTMLElement | undefined>;
5454
"data-testid"?: string;
5555
}
5656

57-
export function DataGridRow(props: DataGridRowProps) {
58-
const { focused, children, ref } = props;
59-
return (
60-
<StyledDataGridRow
61-
$focused={focused}
62-
ref={ref}
63-
data-testid={props["data-testid"]}
64-
>
65-
{children}
66-
</StyledDataGridRow>
67-
);
68-
}
57+
export const DataGridRow = forwardRef(
58+
(props: DataGridRowProps, ref?: React.Ref<HTMLElement | undefined>) => {
59+
const { focused, children } = props;
60+
return (
61+
<StyledDataGridRow
62+
$focused={focused}
63+
ref={ref}
64+
data-testid={props["data-testid"]}
65+
>
66+
{children}
67+
</StyledDataGridRow>
68+
);
69+
},
70+
);
71+
DataGridRow.displayName = "DataGridRow";
6972

7073
const StyledDataGridCell = styled.div<{
7174
$gridRow?: string | number;

0 commit comments

Comments
 (0)