From 7911c8dcb05a65ca5811eefa3a4db67c2fc7cb4b Mon Sep 17 00:00:00 2001 From: keda <53565274+Linkodt@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:02:46 +0800 Subject: [PATCH 1/2] fix: Table MeasureRow bug when children have refs --- src/Body/MeasureCell.tsx | 6 +++--- src/Body/MeasureRow.tsx | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Body/MeasureCell.tsx b/src/Body/MeasureCell.tsx index 1db7d06bb..a080cc145 100644 --- a/src/Body/MeasureCell.tsx +++ b/src/Body/MeasureCell.tsx @@ -6,15 +6,15 @@ import type { ColumnType } from '../interface'; export interface MeasureCellProps { columnKey: React.Key; onColumnResize: (key: React.Key, width: number) => void; - column?: ColumnType; prefixCls: string; + title?: React.ReactNode; } export default function MeasureCell({ columnKey, onColumnResize, - column, prefixCls, + title, }: MeasureCellProps) { const cellRef = React.useRef(); @@ -27,7 +27,7 @@ export default function MeasureCell({ return ( -
{column?.title || '\xa0'}
+
{title || '\xa0'}
); diff --git a/src/Body/MeasureRow.tsx b/src/Body/MeasureRow.tsx index 14ecb2f8e..c0fda2e52 100644 --- a/src/Body/MeasureRow.tsx +++ b/src/Body/MeasureRow.tsx @@ -35,13 +35,17 @@ export default function MeasureRow({ > {columnsKey.map(columnKey => { const column = columns.find(col => col.key === columnKey); + const rawTitle = column?.title; + const titleForMeasure = React.isValidElement>(rawTitle) + ? React.cloneElement(rawTitle, { ref: null }) + : rawTitle; return ( ); })} From a2cf27d2c2c6ee416e240182b1cad04d97ad82f1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 22 Sep 2025 19:11:06 +0800 Subject: [PATCH 2/2] refactor: remove unused ColumnType import in MeasureCell.tsx --- src/Body/MeasureCell.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Body/MeasureCell.tsx b/src/Body/MeasureCell.tsx index a080cc145..11b861148 100644 --- a/src/Body/MeasureCell.tsx +++ b/src/Body/MeasureCell.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import ResizeObserver from 'rc-resize-observer'; import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import type { ColumnType } from '../interface'; export interface MeasureCellProps { columnKey: React.Key;