-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supabase Integration (WIP) #401
Comments
I just migrated my code from using the
(*): I had to use the following code when initializing the offlineRequestQueue: RestOfflineRequestQueue(
client: RestOfflineQueueClient(
http.Client(),
reattemptForStatusCodes: [400, 401, 403, 404 405,408,409,429,500501,502,503,504],
RestRequestSqliteCacheManager(
'offline_queue.sqlite',
databaseFactory: kIsWeb ? databaseFactoryFfiWeb : databaseFactory,
processingInterval: const Duration(seconds: 5),
serialProcessing: true,
),
),
),
When the adapter issue is resolved, I can run the app and provide additional feedback. |
@devj3ns Regarding "While this is acceptable, I would prefer not to import the REST package when using the Supabase integration," I largely agree. Do you think it'd be better to move this logic to the I wrestled with this and felt recycling the code was a suitable tradeoff for the amount of testing/stability behind the REST queue, but I'm less attached to where the code properly lives (as long as the decision can be defended). |
Are all of these status codes necessary from the Supabase API? If they are, they should be a default value in the argument. Latest versions have been published off the #420 (yo @mateominato tell the Dutchie team) branch: brick_offline_first_with_supabase: 0.1.0+1
brick_supabase: 0.1.1
brick_supabase_generators: 0.1.1 For easier testing, it's best to clone this repo locally, |
I think reusing the rest_offline_queue code for the Supabase package is totally fine for now. And I would personally not move it to the When using the |
@tshedor For my app, they are necessary because I want the app user to know when some data could not be upserted when processing the offline queue (no matter why). I think it depends on the app and conflict resolution strategy. I would personally definitely add HTTP 401 (Unauthorized) to the default reattempt status codes for the Supabase queue, as this is the one returned when the JWT expired and that's a case where a reattempt is definitely important. When being precise, HTTP 409 (Conflict) would rather be a "rejectedStatusCode" which had to be handled by the app user instead of reattempting it. But that is another topic which is somewhat related to #393, but unfortunately, I currently do not have much time to think about improving the offline request queue. |
@tshedor That timeline aligns perfectly with my plan. Next week, I'll be running additional tests to ensure that all the app's functionality works seamlessly with the Supabase integration. Once confirmed, I’ll create a new release of my app for production use. I'll report back next week, but my feeling is that everything is looking good so far. Before making a stable release, however, I would definitely suggest adjusting the default reattempt status codes. As mentioned in my previous comment. At a minimum HTTP 401 (Unauthorized) should be added. This status occurs when the client's JWT has expired, which can happen e. g. on the first request after the client comes back online. |
Nice 👍 I think we should add a note to the docs, that when this list includes status codes like 409 (Conflict) or 403 (Forbidden), which could mean that the request is permanently rejected by the Database and no reattempt will succeed, it can block other requests in the queue from sending. What do you think @tshedor? Currently, the biggest thing missing from brick (in my opinion) is handling what happens when a request is permanently rejected by the Remote Provider and all reattempts fail (e.g. HTTP 409 or 403). In my app, which uses serial processing (because of association dependencies) I added a check which detects a blocked request queue and gives the user the ability to discard the rejected request to unblock the queue. When I am done with the file upload thing (on which I will write something to the other issue next week), I will come back to the "more stateful" request queue topic (related: #393). |
This feels a little "water is wet" but if you think it would be useful to include then we should include it. Mind opening a PR?
Yeah, I know this has been bothering you for a while. Do you want to lead the development of the feature since you're closest to it? I'd be more comfortable with this implementation in Supabase because the remote provider is known versus a GraphQL or Rest provider where, in theory, most applications would be using their own, manageable API and would therefore control the status codes. |
@devj3ns How'd this week go? Any further bugs? |
Hey @tshedor, unfortunately, I was very busy with other tasks this week, but I already blocked some hours tomorrow morning to further test the supabase integration. I will report back until tomorrow 10 UTC. |
Yes, I’ll go ahead and open a small PR on Monday.
I'd be happy to do that!
I completely agree! I’ll comment on #393 once I’m ready to start on this, which should be around mid-October. |
Since #418 is merged and all packages are published, I'm going to close this issue. @devj3ns let me know if you're able to smoothly transition using packages from pub.dev . Small release updates can land on #444 . Everything is on the 1.0.0 release except for the offline first with rest stuff, but that's all been published too. |
Please use this issue to follow progress on the Supabase integration. This issue will be opened for comments when the branch is considered stable enough for early testing, so consider subscribing to Notifications. Related: #359
brick_supabase
brick_offline_first_with_supabase
brick_offline_first_with_supabase_build
brick_supabase_generators
brick_supabase_abstractNo longer needed; using the supabase_dart library
brick_offline_first_with_supabase_abstractNo longer needed; using the supabase_dart library
The text was updated successfully, but these errors were encountered: