-
Notifications
You must be signed in to change notification settings - Fork 11
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
Recommend's hooks does not handle errors #134
Comments
Hey @axel-lcdp thank you for raising this issue and the proposed fix, we are looking into it! As for the codesanbox, apologies for the inconvenience, we just pushed a fix. You can find both the React example for reproduction. |
Hi @raed667 any news about when the fix proposed by @axel-lcdp will be merged ? |
Hey @GeryDuComptoirDesPharmacies We're looking on how to handle error boundaries in a consistent way across the different libraries. The change proposed above (as well as #137 ) is a breaking change so we're careful to get it right if we go this route about error management. Edit: I removed the code example, because Out of curiosity what kind of errors are you trying to catch in your use-case ? |
Hi @raed667, There is the error we are trying to catch.
|
Description
Recommend React's hooks does not gracefully handle errors, and errors cannot be caught in React's ErrorBoundary.
For more context :
We are using Algolia's recommend on production and staging environment.
The production environment's index works. The staging environment's index does not build as it has not enough data (less than 1'000 events).
However, when we are running our tests against the staging env, all requests fail because the index does not exists (as it cannot build). The problem, is that all errors cannot be caught and results in React throwing an error.
For instance, in
useFrequentlyBoughtTogether.js
line 42 :It would be great to gracefully handles errors in each hook.
Reproduction
The linked codesandbox does not work. It results with an error
/app.tsx: Unexpected token (133:105)
.Steps
To reproduce the error, you may :
Expected behavior
Error should be gracefully handled by React / hooks.
Environment
The text was updated successfully, but these errors were encountered: