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
OfflineExceptionis 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:GETrequest 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.POSTrequest to an endpoint. Because I want the user to be able to check in and out from an appointment while offline, I catch theOfflineExceptionand update the status of the appointment locally toin progress.in progress, I can proceed to "check out." Tapping the check out button triggers aPOSTrequest to an endpoint. Since we're offline, I get anOfflineExceptionand update the status of the appointment locally tocompleted.This all works great except that when you come back online, the result of the
GETrequest marks the appointment asscheduledagain. This ends up resolving itself because of the otherPOSTrequests 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/PATCHin the Scout app, I don't have a current need to retryGETrequests. 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
isNetworkErrorbut overriding that to always returnfalseappears 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