Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

`onChange` event for SQLiteAdapter/Database #1228

Closed KrisLau closed 2 years ago

KrisLau commented 2 years ago

I've been trying to automate the synchronization with the server and I have been unable to figure it out. I feel like it would be really nice if there was an onChange event in the SQLiteAdapter/Database provider that is fired every time a row/batch of rows are updated or added. That way I could just call the sync() function in the onChange event.

I tried looking through the source code but I could not figure out how to implement it. @radex Do you think this would be a good addition to WDB or is there an easy way to implement auto synchronization between the server and database with WatermelonDB as-is?

KrisLau commented 2 years ago

I found withChangesForTables but the documentation seems to be scarce

PEZO19 commented 2 months ago

@KrisLau Any way to contact you with similar questions and have a discussion?

KrisLau commented 2 months ago

@PEZO19 These comments i left awhile back should be of help to you and generally searching for withChangesForTables in the issues will probably surface a lot of discussions:

The rest of the details are covered by the documentation: https://watermelondb.dev/docs/Sync/Frontend

If you run into issues while implementing, you can open an issue

PEZO19 commented 2 months ago

@KrisLau Sorry, I meant that there is no contact to you on your github page. Any way I can contact you? It seems to me we have very similar problems and thoughts.

KrisLau commented 2 months ago

@PEZO19 I dont do DMs or private contact that's why there's no contact on my github. If you run into issues while implementing, you can open an issue but otherwise just search through the docs and issues