Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added console warning for Table when both subRows and subComponent exist #2288

Merged
merged 8 commits into from
Oct 8, 2024
10 changes: 10 additions & 0 deletions packages/itwinui-react/src/core/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,16 @@ export const Table = <
}
}

if (
process.env.NODE_ENV === 'development' &&
data.some((item) => (item.subRows as T[]).length > 0) &&
subComponent
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
) {
logWarning(
`Passing both \`subComponent\` and \`data\` with \`subRows\` is not supported. There are features designed for \`subRows\` that are not compatible with \`subComponent\` and vice versa.`,
);
}

const ariaDataAttributes = Object.entries(rest).reduce(
(result, [key, value]) => {
if (key.startsWith('data-') || key.startsWith('aria-')) {
Expand Down
Loading