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
2 changes: 1 addition & 1 deletion src/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cls from 'classnames';
import { useEvent } from 'rc-util';
import useEvent from 'rc-util/lib/hooks/useEvent';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

修正 useEvent 的导入方式

'rc-util/lib/hooks/useEvent' 中,useEvent 可能是命名导出(named export),而非默认导出(default export)。当前代码将其作为默认导入,可能导致导入失败。建议修改为命名导入。

应用以下 diff 修复导入语句:

-import useEvent from 'rc-util/lib/hooks/useEvent';
+import { useEvent } from 'rc-util/lib/hooks/useEvent';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import useEvent from 'rc-util/lib/hooks/useEvent';
import { useEvent } from 'rc-util/lib/hooks/useEvent';

import useMergedState from 'rc-util/lib/hooks/useMergedState';
import isEqual from 'rc-util/lib/isEqual';
import warning from 'rc-util/lib/warning';
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useDrag.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEvent } from 'rc-util';
import * as React from 'react';
import useEvent from 'rc-util/lib/hooks/useEvent';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import { UnstableContext } from '../context';
import type { Direction, OnStartMove } from '../interface';
import type { OffsetValues } from './useOffset';
Expand Down Expand Up @@ -44,7 +45,7 @@ function useDrag(

const { onDragStart, onDragChange } = React.useContext(UnstableContext);

React.useLayoutEffect(() => {
useLayoutEffect(() => {
if (draggingIndex === -1) {
setCacheValues(rawValues);
}
Expand Down
Loading