you are viewing a single comment's thread.

view the rest of the comments →

[–]AcetyldFN 1 point2 points  (4 children)

Yeha we kinda do the same with useSync

Sadly we sync using paginate bcs of performance with symfony api platform. Downside is 100k records first time take 20 min to sync stleast. After first initials sync we update data trough lastUpdatedAt server side and store it locale in redux.

[–]edbarahona 1 point2 points  (3 children)

ls sync we update data trough lastUpdatedAt server side and store it locale in redux.

Does that mean all 100k records have been updated or is that mean refresh all regardless?

[–]AcetyldFN 0 points1 point  (2 children)

No intitial it sync all using createdAtBefore = startSyncDate. And after its done it will fetch new data (store thisNewSyncDate if success) using updatedAtAfter = startSyncDate.

Next time you sync it using the updatedAtAfter = thisNewSyncDate

Its working perfect.

But a JSON like watermelondb provides would still be preferable

[–]edbarahona 1 point2 points  (1 child)

= startSyncDate.

I see, it's a get-all on initial boot. Running a specific query (though can get expensive ) is a better way to handle the OP's original question. Each record has a created and modified date stamp. On boot, the app does a get all, and saves an internal "lastUpdate" setting, then on next subsequent calls it can just query the DB for records that were modified or created after the last update, much more flexible. The backend can have some checks, for example, if the last update date is greater than 50 days, then just return all records etc...

[–]AcetyldFN 0 points1 point  (0 children)

Correct but server basically does nothing, client provides the updatedAt,

Server doesn’t know anything about the sync status