Preferred way of handling `429 Too Many Requests` with `createResource`?
I have an API that returns 429 with a
retry-after
header. The way I handle it right now seems... suboptimal to me. It works fine, don't get me wrong, but I have a feeling it culd be handled better.
3 Replies
what do you think can be better here?
in other words what do you feel like is bad here?
Not 100% sure to be honest. The fallback to localstorage irks me, since it could simply not update the current value if the request is throttled
yeah, I guess hiding the problem might be the 1st issue
( fallback to cache on error)
might be acceptable in your use case
2nd issue, is that quote in LocalStorage might be empty
there is no guarantee that this request was called before.