React-instantsearch: Can't catch network error on refine()

Created on 2 Oct 2017  ·  3Comments  ·  Source: algolia/react-instantsearch

I generate API keys that expire quiet quickly, and when the user keeps the tab open on background and comes back after the token has expired, the refine() function called inside a custom search box using connectSearchBox throws a network error I cannot catch. I'd like to be able to handle the error and refresh the page when Algolia returns that error, but could not find any way to do that.

errors

  1. First log thrown by connected search box when refine() is called, not catchable. Query body reads {message: ""validUntil" parameter expired (less than current date)", status: 400}.
  2. Second log thrown by native API client .search() method, catchable.
❔ Question

Most helpful comment

Works like charm 👍

All 3 comments

Did you try componentDidCatch in react 16? I think it might be related

@noclat Also connectResultsState should let you access the error => probably just the error message though, I'll need to check.

Works like charm 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

afgoulart picture afgoulart  ·  4Comments

flouc001 picture flouc001  ·  4Comments

vinhlh picture vinhlh  ·  5Comments

markmiller21 picture markmiller21  ·  3Comments

flouc001 picture flouc001  ·  5Comments