hxf31891 / react-gradient-color-picker

An easy to use color/gradient picker for React.js
MIT License
146 stars 49 forks source link

Maximum update depth exceeded when using useColorPicker #24

Closed jpdery closed 2 years ago

jpdery commented 2 years ago

Hi, I'm using version 2.0.17 with react 18.1.0 and as soon as I call useColorPicker, I get a maximum update depth error.

image

Is there a way to fix this ?

Thanks

BentleyDavis commented 2 years ago

We are seeing this in both React 17 and 18. Here is a React 18 code Sandbox with just your demo code in it: We will need to go back to version 2.0.10

https://codesandbox.io/s/eloquent-cloud-oiq2hg

image

BentleyDavis commented 2 years ago

I did a diff between v2.0.10 and v2.0.11 and I don't see anything obvious. There were a lot of changes to enable the new width prop. It would take while learning the code and to debug it. I'm not sure I will have the time to dedicate to find it.

hxf31891 commented 2 years ago

Thats no good, I will take a look tonight.

hxf31891 commented 2 years ago

@BentleyDavis & @jpdery thanks for pointing this out, it seems to have slipped through the cracks. I'm not exactly sure what updates were breaking, or better said I'm not sure how that function ever worked, but it was any easy fix. See version 2.0.19.

Happy coding!