Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"@rc-component/context": "^2.0.1",
"@rc-component/resize-observer": "^1.0.0",
"@rc-component/util": "^1.1.0",
"clsx": "^2.1.1",
"rc-virtual-list": "^3.14.2"
"@rc-component/virtual-list": "^1.0.1",
"clsx": "^2.1.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^2.0.1",
Expand Down
4 changes: 2 additions & 2 deletions src/VirtualTable/BodyGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext } from '@rc-component/context';
import VirtualList, { type ListProps, type ListRef } from 'rc-virtual-list';
import VirtualList, { type ListProps, type ListRef } from '@rc-component/virtual-list';
import * as React from 'react';
import TableContext, { responseImmutable } from '../context/TableContext';
import useFlattenRecords, { type FlattenData } from '../hooks/useFlattenRecords';
Expand Down Expand Up @@ -224,7 +224,7 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
// ========================== Render ==========================
const tblPrefixCls = `${prefixCls}-tbody`;

// default 'div' in rc-virtual-list
// default 'div' in @rc-component/virtual-list
const wrapperComponent = getComponent(['body', 'wrapper']);

// ========================== Sticky Scroll Bar ==========================
Expand Down
4 changes: 2 additions & 2 deletions tests/Virtual.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const identity = (value: any) => value;
global.scrollToConfig = null;
global.collectGetScrollInfoReturn = identity;

vi.mock('rc-virtual-list', async () => {
const RealVirtualList = ((await vi.importActual('rc-virtual-list')) as any).default;
vi.mock('@rc-component/virtual-list', async () => {
const RealVirtualList = ((await vi.importActual('@rc-component/virtual-list')) as any).default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve type safety and avoid using as any, you can use a dynamic import for the type with vi.importActual. This will provide proper typing for RealVirtualList and make the test mock more robust.

Suggested change
const RealVirtualList = ((await vi.importActual('@rc-component/virtual-list')) as any).default;
const { default: RealVirtualList } = await vi.importActual<typeof import('@rc-component/virtual-list')>('@rc-component/virtual-list');


const WrapperVirtualList = React.forwardRef((props: any, ref) => {
const myRef = React.useRef(null);
Expand Down