excluding certain requests from offline queue? #134
Replies: 2 comments
-
Hey @jamesdixon ! Yeah, I would've said the logical place to implement this would be The other option is to override Filtering out during the retry logic seems to be the most straightforward way, have you encountered limitations doing that? |
Beta Was this translation helpful? Give feedback.
-
@jamesdixon Latest versions of FD only treat writes as offline operations, so in your case there would be no need to exclude |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, @frank06!
Working on the "new" Scout app in my "free" time and came across something that I wanted to get your take on.
With FD's current offline setup, any operation that results in an
OfflineException
is stored in the queue to retry. However, there are cases when you would not want every single operation retried. Here's an example from the Scout app:GET
request to fetch the details of the appointment. This request fails because you're offline, but the user still sees the appointment details from the local database.POST
request to an endpoint. Because I want the user to be able to check in and out from an appointment while offline, I catch theOfflineException
and update the status of the appointment locally toin progress
.in progress
, I can proceed to "check out." Tapping the check out button triggers aPOST
request to an endpoint. Since we're offline, I get anOfflineException
and update the status of the appointment locally tocompleted
.This all works great except that when you come back online, the result of the
GET
request marks the appointment asscheduled
again. This ends up resolving itself because of the otherPOST
requests that follow but makes the user experience a bit wonky.All that said, I'm curious if having the ability to exclude certain types of requests from being retried? For example, since any requests that modify state are done by
POST/PATCH
in the Scout app, I don't have a current need to retryGET
requests. I'm currently filtering this out in the code that retries offline requests, but it'd probably be ideal to skip those entirely so they never make it to the queue.I do see
isNetworkError
but overriding that to always returnfalse
appears to skip offline retries for the entire model.Lemme know what ya think or if this is something that feels to specific to my use case.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions