From 03b736538f4af3c8b61b5610842eea751138301b Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Mon, 1 Dec 2025 14:48:08 +0800 Subject: [PATCH 1/5] migrate to @rc-component/virtual-list --- package.json | 4 ++-- src/BaseSelect/index.tsx | 2 +- src/OptionList.tsx | 6 +++--- tests/OptionList.test.tsx | 12 ++++++++---- tests/Select.test.tsx | 2 +- tests/__mocks__/rc-virtual-list.tsx | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 2ba11fe2d..6c7d9e0e3 100644 --- a/package.json +++ b/package.json @@ -51,9 +51,9 @@ "dependencies": { "@rc-component/trigger": "^3.0.0", "@rc-component/util": "^1.3.0", + "@rc-component/virtual-list": "^1.0.0", "clsx": "^2.1.1", - "rc-overflow": "^1.5.0", - "rc-virtual-list": "^3.5.2" + "rc-overflow": "^1.5.0" }, "devDependencies": { "@rc-component/father-plugin": "^2.0.2", diff --git a/src/BaseSelect/index.tsx b/src/BaseSelect/index.tsx index 1cd445cde..d740e91ad 100644 --- a/src/BaseSelect/index.tsx +++ b/src/BaseSelect/index.tsx @@ -1,7 +1,7 @@ import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface'; import { clsx } from 'clsx'; import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode'; -import type { ScrollConfig, ScrollTo } from 'rc-virtual-list/lib/List'; +import type { ScrollConfig, ScrollTo } from '@rc-component/virtual-list/lib/List'; import * as React from 'react'; import { useAllowClear } from '../hooks/useAllowClear'; import { BaseSelectContext } from '../hooks/useBaseProps'; diff --git a/src/OptionList.tsx b/src/OptionList.tsx index d2e8b2212..c24c19ecf 100644 --- a/src/OptionList.tsx +++ b/src/OptionList.tsx @@ -3,9 +3,9 @@ import KeyCode from '@rc-component/util/lib/KeyCode'; import useMemo from '@rc-component/util/lib/hooks/useMemo'; import omit from '@rc-component/util/lib/omit'; import pickAttrs from '@rc-component/util/lib/pickAttrs'; -import type { ListRef } from 'rc-virtual-list'; -import List from 'rc-virtual-list'; -import type { ScrollConfig } from 'rc-virtual-list/lib/List'; +import type { ListRef } from '@rc-component/virtual-list'; +import List from '@rc-component/virtual-list'; +import type { ScrollConfig } from '@rc-component/virtual-list/lib/List'; import * as React from 'react'; import { useEffect } from 'react'; import type { BaseOptionType, RawValueType } from './Select'; diff --git a/tests/OptionList.test.tsx b/tests/OptionList.test.tsx index b73b370d0..4f7dfe479 100644 --- a/tests/OptionList.test.tsx +++ b/tests/OptionList.test.tsx @@ -13,9 +13,9 @@ import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; jest.mock('../src/utils/platformUtil'); // Mock VirtualList -jest.mock('rc-virtual-list', () => { +jest.mock('@rc-component/virtual-list', () => { const OriReact = jest.requireActual('react'); - const OriList = jest.requireActual('rc-virtual-list').default; + const OriList = jest.requireActual('@rc-component/virtual-list').default; return OriReact.forwardRef((props, ref) => { const oriRef = OriReact.useRef(); @@ -561,7 +561,9 @@ describe('OptionList', () => { const { container } = render(); await waitFor(() => { - const scrollbarElement = container.querySelector('.rc-virtual-list-scrollbar-visible'); + const scrollbarElement = container.querySelector( + '.@rc-component/virtual-list-scrollbar-visible', + ); expect(scrollbarElement).toBeNull(); }); }); diff --git a/tests/Select.test.tsx b/tests/Select.test.tsx index e311e1a42..e97e45e7f 100644 --- a/tests/Select.test.tsx +++ b/tests/Select.test.tsx @@ -9,7 +9,7 @@ import { import KeyCode from '@rc-component/util/lib/KeyCode'; import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { resetWarned } from '@rc-component/util/lib/warning'; -import type { ScrollConfig } from 'rc-virtual-list/lib/List'; +import type { ScrollConfig } from '@rc-component/virtual-list/lib/List'; import React, { StrictMode } from 'react'; import type { SelectProps } from '../src'; import Select, { OptGroup, Option, useBaseProps } from '../src'; diff --git a/tests/__mocks__/rc-virtual-list.tsx b/tests/__mocks__/rc-virtual-list.tsx index 21b6e92a8..a83162135 100644 --- a/tests/__mocks__/rc-virtual-list.tsx +++ b/tests/__mocks__/rc-virtual-list.tsx @@ -1,3 +1,3 @@ -import List from 'rc-virtual-list/lib/mock'; +import List from '@rc-component/virtual-list/lib/mock'; export default List; From 8f1a5ab819824faca98e6af8b9eccf6227d4fde7 Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Mon, 1 Dec 2025 14:49:42 +0800 Subject: [PATCH 2/5] revert --- tests/OptionList.test.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/OptionList.test.tsx b/tests/OptionList.test.tsx index 4f7dfe479..8ff40d1c3 100644 --- a/tests/OptionList.test.tsx +++ b/tests/OptionList.test.tsx @@ -561,9 +561,7 @@ describe('OptionList', () => { const { container } = render(); await waitFor(() => { - const scrollbarElement = container.querySelector( - '.@rc-component/virtual-list-scrollbar-visible', - ); + const scrollbarElement = container.querySelector('.rc-virtual-list-scrollbar-visible'); expect(scrollbarElement).toBeNull(); }); }); From f3483b49b91efc79622a0a21443f20552090db84 Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Mon, 1 Dec 2025 16:48:10 +0800 Subject: [PATCH 3/5] upgrade --- package.json | 2 +- tests/__snapshots__/Select.test.tsx.snap | 12 ++++++------ tests/__snapshots__/Tags.test.tsx.snap | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 6c7d9e0e3..628cd05bd 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "prettier": "^3.1.1", "querystring": "^0.2.1", "rc-dialog": "^9.0.0", - "rc-test": "^7.0.9", + "rc-test": "^7.1.2", "react": "^18.2.0", "react-dom": "^18.2.0", "typescript": "^5.2.2" diff --git a/tests/__snapshots__/Select.test.tsx.snap b/tests/__snapshots__/Select.test.tsx.snap index 76ed88b0a..96bb6382a 100644 --- a/tests/__snapshots__/Select.test.tsx.snap +++ b/tests/__snapshots__/Select.test.tsx.snap @@ -34,7 +34,7 @@ exports[`Select.Basic does not filter when filterOption value is false 1`] = ` >
Date: Mon, 1 Dec 2025 16:50:02 +0800 Subject: [PATCH 4/5] upgrade --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 628cd05bd..1931f1869 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "dependencies": { "@rc-component/trigger": "^3.0.0", "@rc-component/util": "^1.3.0", - "@rc-component/virtual-list": "^1.0.0", + "@rc-component/virtual-list": "^1.0.1", "clsx": "^2.1.1", "rc-overflow": "^1.5.0" }, From 4bb0c1426fa54496b34297515b841bcbc806242b Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Tue, 2 Dec 2025 11:45:19 +0800 Subject: [PATCH 5/5] fix mock --- .../virtual-list.tsx} | 0 tests/__snapshots__/Select.test.tsx.snap | 12 ++++++------ tests/__snapshots__/Tags.test.tsx.snap | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) rename tests/__mocks__/{rc-virtual-list.tsx => @rc-component/virtual-list.tsx} (100%) diff --git a/tests/__mocks__/rc-virtual-list.tsx b/tests/__mocks__/@rc-component/virtual-list.tsx similarity index 100% rename from tests/__mocks__/rc-virtual-list.tsx rename to tests/__mocks__/@rc-component/virtual-list.tsx diff --git a/tests/__snapshots__/Select.test.tsx.snap b/tests/__snapshots__/Select.test.tsx.snap index 96bb6382a..76ed88b0a 100644 --- a/tests/__snapshots__/Select.test.tsx.snap +++ b/tests/__snapshots__/Select.test.tsx.snap @@ -34,7 +34,7 @@ exports[`Select.Basic does not filter when filterOption value is false 1`] = ` >