farmOS / field-kit

A modular, offline-first companion app to farmOS.
https://farmOS.org
GNU General Public License v3.0
62 stars 39 forks source link

Use updated syncing procedures in Vuex actions. #479

Closed jgaehring closed 2 years ago

jgaehring commented 2 years ago

In the course of #465, particularly commit 04fd9e8, I used the implementation of refreshCache and syncCache to try out some new ideas for improving the behavior of FK's syncing logic, as well as its internal architecture. In particular, I tried to isolate the syncEntity function from the specific requirements of syncCache so that I might eventually employ this function in the syncEntities action in the Vuex store as well. If it is successful there, I may even wish to include this in farmOS.js itself, as part of the special functionality provided when you use the main farmOS constructor that integrates features of both the model and the client.

In terms of behavioral improvements, there are some much needed fixes in syncEntity, as well as corresponding improvements in farmOS.js (beta releases 2 and 4), which will ensure that syncing entities in FK will be more exhaustive, with the introduction of the limit option. I also want to use the opportunity to make improvements to SyncError and fully integrate the cacheEntity and cachingCriteria functions from idb/cache.js.

jgaehring commented 2 years ago

Most of the necessary changes have been made with 35aae84, but I think I still need to fine tune some issues in farmOS.js. Namely, I've noticed that not all entities are getting their lastSync timestamp set properly, which is causing unnecessary send requests. Also, some taxonomy terms aren't getting created metadata from the server, and are being given a url or /taxonomy_term/undefined, which should be fixed, but is not a blocker for this issue.

jgaehring commented 2 years ago

I've noticed that not all entities are getting their lastSync timestamp set properly

I think this was just a relic of the failed syncs that were leaving some bad metadata in the database as I was testing. Clearing all site data and running it fresh seems to have resolved this.