I want to use Dexie within the service worker to sync my data. I also want to use useLiveQuery hook in the React frontend.
Would Dexie automatically update the query if new data gets written in the service worker thread?
I want to use Dexie within the service worker to sync my data. I also want to use useLiveQuery hook in the React frontend.
Would Dexie automatically update the query if new data gets written in the service worker thread?
If data is written to the database by your Service worker, the React frontend will be notified instantly and update accordingly. Communication goes via BroadcastChannel. If using a legacy Safari browser that lacks BroadcastChannel support, dexie has a fallback so that mutations done in the service worker will be communicated using postMessage(). This is all taken care of by dexie itself.