From 482ccda2279656fff5c669e847de198a9fda545b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E8=89=B3=E5=85=B5?= Date: Fri, 21 Aug 2026 09:26:06 +0800 Subject: [PATCH 1/2] fix(Descriptions): preserve item state when key is 0 (#59064) * fix(Descriptions): preserve item state for zero key * refactor(Descriptions): extract merged item key --- components/descriptions/Row.tsx | 8 +++--- .../descriptions/__tests__/index.test.tsx | 27 +++++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/components/descriptions/Row.tsx b/components/descriptions/Row.tsx index c8103ca64a8f..593df00b5225 100644 --- a/components/descriptions/Row.tsx +++ b/components/descriptions/Row.tsx @@ -42,10 +42,12 @@ function renderCells( }, index, ) => { + const mergedKey = key ?? index; + if (typeof component === 'string') { return ( , { @@ -284,6 +284,29 @@ describe('Descriptions', () => { expect(jest.spyOn(document, 'createElement')).not.toHaveBeenCalled(); }); + it('should preserve item state after reordering when key is 0', () => { + const items = [ + { + key: 0, + label: 'Zero', + children: , + }, + { + key: 2, + label: 'Two', + children: , + }, + ]; + const { getByLabelText, rerender } = render(); + const input = getByLabelText('Zero value'); + + fireEvent.change(input, { target: { value: 'edited' } }); + rerender(); + + expect(getByLabelText('Zero value')).toBe(input); + expect(getByLabelText('Zero value')).toHaveValue('edited'); + }); + // https://github.com/ant-design/ant-design/issues/19887 it('should work with React Fragment', () => { if (!React.Fragment) { From 2b258157ff20fb8948780e414dc1d74246aede40 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 21 Aug 2026 09:35:41 +0800 Subject: [PATCH 2/2] Revert "site: fix code-box style with Badge" (#59065) * Revert "site: fix code-box style with Badge (#59063)" This reverts commit 44f96c8a49963b9b1bff9305b1831893006240bf. * update * update * update --- .dumi/theme/common/styles/Demo.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.dumi/theme/common/styles/Demo.tsx b/.dumi/theme/common/styles/Demo.tsx index 77eabf85e720..5b0a04c1dd1b 100644 --- a/.dumi/theme/common/styles/Demo.tsx +++ b/.dumi/theme/common/styles/Demo.tsx @@ -22,13 +22,13 @@ const GlobalDemoStyles: React.FC = () => { .code-box { position: relative; display: inline-block; - /* width: calc(100% - ${token.lineWidth * 2}px); */ - width: 100%; + width: calc(100% - ${token.lineWidth * 2}px); margin: 0 0 ${token.margin}px; background-color: ${token.colorBgContainer}; - border: 1px solid ${token.colorSplit}; + border: ${token.lineWidth}px ${token.lineType} ${token.colorSplit}; border-radius: ${token.borderRadiusLG}px; transition: all ${token.motionDurationMid}; + box-sizing: content-box; &.code-box-simplify { border-radius: 0;