samuk190 / localbase

A Firebase-Style Database ... Offline!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Watch for changes

rvetrsek opened this issue · comments

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.

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

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