Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useDebounce now fired on component mount #759

Open
newsiberian opened this issue Nov 8, 2019 · 3 comments
Open

useDebounce now fired on component mount #759

newsiberian opened this issue Nov 8, 2019 · 3 comments
Assignees

Comments

@newsiberian
Copy link

newsiberian commented Nov 8, 2019

What is the current behavior?
Hook now fired even when component has been mounted.

Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than react-use. Paste the link to your JSFiddle or CodeSandbox example below:

What is the expected behavior?
I expect that hook should be called only after I edit input.

A little about versions:

  • OS:
  • Browser (vendor and version):
  • React:
  • react-use: 13.3.0
  • Did this worked in the previous package version?
    This behavior not reproduced in [email protected]
@xobotyi
Copy link
Contributor

xobotyi commented Nov 8, 2019

I'll take a look in few days.

@skrzepij
Copy link

Any changes about this issue?
Have the same problem and I'm thinking about using useRef flag inside useDebounce. But I think this should be implemented by default into useDebounce hook.

@mariadriana-deemaze
Copy link

Same issue here. It seems that the useDebounce is relying on the useEffect lifecycle. To go around this, I used useRendersCount() as a flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants