Local database saves - aka: Queued update/inserts, aka: Offline editing

It would be very helpful and performant in many applications if when a record is changed and saved, the local query.data is updated without the need to do a round trip to the server and reload the query and the table and whatever else depends on the query.

Maybe the bulk update/insert queries are postponed/queued. The user can keep editing/viewing the app data until he hits Save at which point all of the queued queries are run.

I realize that this puts the local version out of sync with the master database, and in some applications this would be a deal killer. But in some it would be just fine and speed things up a lot. It would also be a major piece of the puzzle to allow offline editing.

Hmmm, if you could create a localstore connector then we could query the local store as if it were a database. To roll our own version of offline/queued updates the workflow might go something like this:

  1. Query database on app load.
  2. Store query.data into localstore
  3. Tables and components are loaded with data from localstore queries.
  4. Saving changes go to the local store using insert/update queries as usual.
  5. We would need to maintain our own recordUpdates object.
  6. When we wanted to we could then run bulkupdate queries with our recordUpdates object.
  7. In order to account for autoincrement IDs in a multiuser environment, we would also need to keep track of of our own addRows object and if any records in it are updated, we update that instead of recordUpdates.

This seems rather straightforward (so I must be missing something!), we just need that localstore connector!

1 Like