Vue/Nuxt shared liveQuery composables for Dexie #2301
Replies: 2 comments
|
Update: this lifecycle model has since been clarified further. Active consumers now re-wait with their last snapshot when their producer is cleaned up and reattach when a replacement producer registers the same key. See my follow-up comment below for the current behavior. Small follow-up: we tightened the producer/consumer semantics after testing the shared subscription model more deeply.
This made the Vue/Nuxt wrapper align better with native Dexie ownership: the actual Dexie subscription has a single owner, while consumers are only views over the shared state. Updated package/demo:
Still interested in feedback from Dexie users on whether this producer/consumer split feels like the right abstraction around |
|
Another update after refining the lifecycle around page-level producers and longer-lived consumers: The wrapper now supports consumer reattach after producer cleanup while keeping Dexie subscription ownership explicit. Current model:
The intent is to support Vue/Nuxt layouts or components that can outlive a page-level producer without turning consumers into hidden Dexie subscription owners. We documented the decision and lifecycle here:
This keeps the abstraction close to Dexie: one explicit |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
while building larger Vue and Nuxt apps with Dexie, we noticed that multiple components often ended up creating their own liveQuery subscriptions for the same IndexedDB state.
Dexie already has excellent React support with dexie-react-hooks, but we could not find a dedicated shared subscription pattern for Vue/Nuxt around liveQuery.
So we built dexie-reactive.
The package introduces a small producer/consumer model for Dexie live queries:
The goal was to stay very close to native Dexie patterns while making shared reactive state easier to manage in Vue applications.
Live Demo
https://stackblitz.com/~/github.com/Nessiahs/dexie-reactive-playground?file=.env
npm
https://www.npmjs.com/package/dexie-reactive
GitHub
https://github.com/Nessiahs/dexie-reactive
Would love feedback from the Dexie community:
Thanks for building Dexie — this project would not exist without it.
All reactions