diff --git a/.changeset/cuddly-gorillas-type.md b/.changeset/cuddly-gorillas-type.md new file mode 100644 index 00000000000..3bfa4f4912c --- /dev/null +++ b/.changeset/cuddly-gorillas-type.md @@ -0,0 +1,5 @@ +--- +'@itwin/itwinui-react': patch +--- + +Added warning log in browser when both `subRows` and `subComponent` are passed into `Table`. diff --git a/packages/itwinui-react/src/core/Table/Table.tsx b/packages/itwinui-react/src/core/Table/Table.tsx index 8bbe3feb639..e48d97e53af 100644 --- a/packages/itwinui-react/src/core/Table/Table.tsx +++ b/packages/itwinui-react/src/core/Table/Table.tsx @@ -656,6 +656,16 @@ export const Table = < } } + if ( + process.env.NODE_ENV === 'development' && + subComponent && + data.some((item) => !!(item.subRows as T[] | undefined)?.length) + ) { + 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-')) {