podefr/react-debounce-render

Throws a warning when component is unmounted before the debounced function executes

mjhm opened this issue · 4 comments

mjhm commented
Throws a warning when component is unmounted before the debounced function executes
mjhm commented

@podefr Thank you for this tool, it's saved me from some annoyingly slow form updates.

I'm running into this minor problem though sometimes when I'm navigatating off a page:

When the debounced component is unmounted before the final debounced function execution we get React warnings that look like: Warning: Can't call setState (or forceUpdate) on an unmounted component.

For example see the test case in #6

Thanks so much @mjhm for raising the issue and suggesting a fix, I'll take a look at the pull request shortly!

Thanks @mjhm I just pushed v4.0.1 with the fix. Let me know if it closes the issue!

mjhm commented

Warning all gone! Thank you!