Skip to content

Commit

Permalink
fix: ensure latest previous position value is used to determine when …
Browse files Browse the repository at this point in the history
…to use position prop
  • Loading branch information
nerdyman committed Feb 23, 2020
1 parent 1604a0f commit fb8d7cd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/react-compare-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ export const ReactCompareSlider: React.FC<ReactCompareSliderProps &
x: (width / 100) * position,
y: (height / 100) * position,
});
// `prevPropsPosition` is a ref value so it shouldn't been in deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [position, updateInternalPosition]);
}, [position, prevPropsPosition, updateInternalPosition]);

/** Handle mouse/touch down */
const handlePointerDown = useCallback(
Expand Down

0 comments on commit fb8d7cd

Please sign in to comment.