From 70043c3c2c28efdbbc9237b6a3b9bec36ced38a1 Mon Sep 17 00:00:00 2001 From: LostABike <22462084+LostABike@users.noreply.github.com> Date: Wed, 10 May 2023 13:23:18 -0500 Subject: [PATCH] Add check for undefined header in Column resizer (#1156) --- .changeset/hip-suns-repeat.md | 5 +++++ .../itwinui-react/src/core/Table/hooks/useResizeColumns.tsx | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/hip-suns-repeat.md diff --git a/.changeset/hip-suns-repeat.md b/.changeset/hip-suns-repeat.md new file mode 100644 index 00000000000..3a3419a88e0 --- /dev/null +++ b/.changeset/hip-suns-repeat.md @@ -0,0 +1,5 @@ +--- +'@itwin/itwinui-react': patch +--- + +Fixes an issue where table crashes when resizing the Column Manager column in expand mode. diff --git a/packages/itwinui-react/src/core/Table/hooks/useResizeColumns.tsx b/packages/itwinui-react/src/core/Table/hooks/useResizeColumns.tsx index ccf6f733c9a..bab0eee8e78 100644 --- a/packages/itwinui-react/src/core/Table/hooks/useResizeColumns.tsx +++ b/packages/itwinui-react/src/core/Table/hooks/useResizeColumns.tsx @@ -494,6 +494,9 @@ function getLeafHeaders(header: HeaderGroup) { const getHeaderWidth = >( header: ColumnInstance, ) => { + if (!header) { + return 0; + } return Number(header.width || header.resizeWidth || 0); };