sergiodxa / remix-utils

A set of utility functions and types to use with Remix.run
https://sergiodxa.github.io/remix-utils/
MIT License
2.07k stars 116 forks source link

Fix useDebounceSubmit recursively calling itself #283

Closed jacobparis closed 9 months ago

jacobparis commented 9 months ago

In my original useDebounceSubmit implementation, I used a separate debounceSubmit method to prevent a recursive loop where when the debounced fetcher finally submits, it triggers a new debounce call and overflows the call stack

The version currently in remix-utils suffers this bug, but it can be avoided without renaming the submit call by storing the initial submit function and avoiding re-calling the debounced version afterward

Once merged I will update my blog posts and examples to use this util instead of my original implementation

sergiodxa commented 9 months ago

Released on v7.3.0