Skip to content

Commit

Permalink
fix(table): Sortable 组件提取到外部防止不必要的页面重建 (ant-design#6246)
Browse files Browse the repository at this point in the history
  • Loading branch information
yqz0203 committed Nov 28, 2022
1 parent 4311872 commit 9247c4a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/table/src/utils/useDragSort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ export interface UseDragSortOptions<T> {
components?: TableComponents<T>;
rowKey: any;
}

const SortableItem = SortableElement((p: any) => <tr {...p} />);
const SortContainer = SortableContainer((p: any) => <tbody {...p} />);

export function useDragSort<T>(props: UseDragSortOptions<T>) {
const { dataSource = [], onDragSortEnd, dragSortKey } = props;

// 拖拽排序相关逻辑
const SortableItem = SortableElement((p: any) => <tr {...p} />);
const SortContainer = SortableContainer((p: any) => <tbody {...p} />);

/* istanbul ignore next */
const handleSortEnd = useRefFunction((params: SortDataParams) => {
/* istanbul ignore next */
Expand Down

0 comments on commit 9247c4a

Please sign in to comment.