samuk190 / localbase

A Firebase-Style Database ... Offline!
636 stars 84 forks source link

Watch for changes #48

Open rvetrsek opened 3 years ago

rvetrsek commented 3 years ago

I'll probably be using this plugin in my new Vite+Vue+Electron app and I was wondering if there is a way that I can watch for changes in the DB? So for example, if I open two renderers and add/change the data in one that it would directly be reflected in the other.

teamsuperpanda commented 2 years ago

Not really. In this case I think the common approach would be to use Vuex. Fetch the data from the database and then store it in your vuex store.

Multiple components can request to run an action in your vuex store which would then fetch a fresh copy of the database and store it in your store => updating the state => which triggers to re-render

Erasmus001 commented 1 year ago

But if this little feature was to be implemented, it would reduce the precious time to write that logic and above all simplify the developer experience