podefr / react-debounce-render

A React higher order component to debounce the rendering of your React components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mjhm opened this issue · comments

@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!

Warning all gone! Thank you!