Skip to content

Commit 2d76a3e

Browse files
fix(@clayui/color-picker): update Hue before the browser can paint
Updating Hue in most cases was causing blocking since we are always updating the `left` of the range pointer.
1 parent 4c292d5 commit 2d76a3e

File tree

1 file changed

+2
-2
lines changed
  • packages/clay-color-picker/src

1 file changed

+2
-2
lines changed

packages/clay-color-picker/src/Hue.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
66

7-
import React, {useEffect, useRef} from 'react';
7+
import React, {useEffect, useLayoutEffect, useRef} from 'react';
88

99
import {useMousePosition} from './hooks';
1010
import {hueToX, xToHue} from './util';
@@ -40,7 +40,7 @@ const ClayColorPickerHue: React.FunctionComponent<IProps> = ({
4040
window.removeEventListener('mouseup', removeListeners);
4141
};
4242

43-
useEffect(() => {
43+
useLayoutEffect(() => {
4444
if (containerRef.current && selectorActive.current) {
4545
onChange(xToHue(x, containerRef.current));
4646
}

0 commit comments

Comments
 (0)