mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-17 05:02:23 +08:00
chore: refactor changes
This commit is contained in:
parent
e6e1e6b1e0
commit
ea90b2367b
@ -216,16 +216,11 @@ const useColorInput = (
|
||||
|
||||
// Reset state when initialValue changes (when resetting controls)
|
||||
useEffect(() => {
|
||||
if (initialValue !== undefined) {
|
||||
const parsed = parseValue(initialValue);
|
||||
setValue(initialValue);
|
||||
setColor(parsed);
|
||||
setColorSpace(parsed.colorSpace);
|
||||
return;
|
||||
}
|
||||
setValue('');
|
||||
setColor(undefined);
|
||||
setColorSpace(ColorSpace.HEX);
|
||||
const nextValue = initialValue || '';
|
||||
const nextColor = parseValue(nextValue);
|
||||
setValue(nextValue);
|
||||
setColor(nextColor);
|
||||
setColorSpace(nextColor?.colorSpace || ColorSpace.HEX);
|
||||
}, [initialValue]);
|
||||
|
||||
const realValue = useMemo(
|
||||
|
Loading…
x
Reference in New Issue
Block a user