Skip to content

Commit

Permalink
fix: fix useLayoutEffect warning (#1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo837 authored Oct 8, 2024
1 parent 7853d7f commit 79e4d40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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';
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

0 comments on commit 79e4d40

Please sign in to comment.