Skip to content

Commit

Permalink
Add check for stickyTableHeadings.current.length in resizeTableHeadin…
Browse files Browse the repository at this point in the history
…gs so our code does not error when the ref is not initialised
  • Loading branch information
gwyneplaine authored and jesstelford committed Feb 26, 2024
1 parent 5676d5e commit 4a46d98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion polaris-react/src/components/IndexTable/IndexTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ function IndexTableBase({
}

// update left offset for first column
if (selectable && tableHeadings.current.length > 1) {
if (
selectable &&
tableHeadings.current.length > 1 &&
stickyTableHeadings.current.length > 1
) {
tableHeadings.current[1].style.left = `${tableHeadingRects.current[0].offsetWidth}px`;
stickyTableHeadings.current[1].style.left = `${tableHeadingRects.current[0].offsetWidth}px`;
}
Expand Down

0 comments on commit 4a46d98

Please sign in to comment.