You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let the fetcher raise an error if all the properties are not hydrated and use onErrorRetry to handle the logic.
The problem with this option is that I cannot find a way to mutate the object so that the react components that ie can have a value (ie title) to get that value shown.
Ie:
onErrorRetry: (
error: ErrorWithData<Product>,
key,
config,
revalidate,
{ retryCount },
) => {
if (error.status === ErroStatus.Processing && retryCount <= 10) {
console.log('retry', retryCount);
// Retry after 5 seconds.
setTimeout(() => revalidate({ retryCount }), 5000);
return;
}
console.log('Done');
},
And later on on my component this wont show till the error is not longer
<Tooltip
title={product?.title}
placement={tooltipPlacement as TooltipPlacement}
>
Option B
Use polling every x seconds and stop it after all props are done. However this beats the automatic expotential backoff that the error retry offers ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi ,
I have an API call that gets some products by ean (id).
That api call returns an object that some properties can be null. Those properties will start being hydrated as a backend async task will finish.
For example
getprod/123
returns{title: 'hello', price: null }
At this moment have 2 options:
Option A:
Let the fetcher raise an error if all the properties are not hydrated and use
onErrorRetry
to handle the logic.The problem with this option is that I cannot find a way to mutate the object so that the react components that ie can have a value (ie title) to get that value shown.
Ie:
Option B
Use polling every x seconds and stop it after all props are done. However this beats the automatic expotential backoff that the error retry offers ?
Any ideas / discussion ?
Thanks for your time and great library !
Beta Was this translation helpful? Give feedback.
All reactions