Value debouncing breaks in react native on expo when component is refreshed
Closed this issue · 5 comments
Just thought to let you know, a simple const [valueDebounced] = useDebounce(value, 100)
tested in react native on expo works fine - until the component is refreshed (because you've made a code change and saved the file). Unless the change altered the initial value of the value
state, the link between the value
and the valueDebounced
is broken and valueDebounced
no longer updates at all.
Hi @finnmerlett
Thank you for the info!
I would take a look at the problem with react native when I get some free time.
Also, you're welcome to PR me
Fantastic, thanks. Also wanted to say that apart from that one issue, the module works excellently!
Have noticed that refreshing on Next.js breaks it as well. I believe this is since Next.js 9.4, which uses react-refresh for reloading - which I think is the same mechanism react-native uses.
Hi, @finnmerlett , @cfraz89
I've fixed the issue.
I've published use-debounce@3.4.3
which should work with both next.js and react native, as they are using a similar refreshing mechanism.