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
Hello :)
I have 2 SWR hooks -
useApplicantsCount,
useApplicantsFavorites,
Count gives me the count of favorites + submitted applications, and favorites just gives me a list of unrelated data (job positions).
When I add something new to favorites I am already optimistically updating favorites with the new item, but I also need to update count.
For now I am invoking Count's mutate() like so,
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hello :)
I have 2 SWR hooks -
useApplicantsCount,
useApplicantsFavorites,
Count gives me the count of favorites + submitted applications, and favorites just gives me a list of unrelated data (job positions).
When I add something new to favorites I am already optimistically updating favorites with the new item, but I also need to update count.
For now I am invoking Count's mutate() like so,
triggerPostFavorite(
{ positionId },
{
optimisticData: favorites && [
...favorites,
{ positionId } as IPosition,
],
onSuccess: () => mutateCount(),
}
However there is a slight delay, it would be nice if I were able to to tell SWR that count is dependent on favorites :)
Beta Was this translation helpful? Give feedback.
All reactions