-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential improvements for Vue's reactivity system #277
Comments
Hey @sandros94 Thanks for the report. My understanding is that if you use Have you seen our Vue hooks (https://pglite.dev/docs/framework-hooks/vue)? Are these useful for your project? Let me know if you have any feedback on them. |
Yes indeed, and I'm currently going with the
But as per my understanding of Vue's reactivity system is that with a Take the following example from Vue's official docs:
This means that in order to make Vue aware of each exec/query executions (since const pg = shallowRef(new PGlite(options))
async function query<T>(query: string, params?: any[], options?: QueryOptions) {
const res = await pg.value.query<T>(query, params, options)
triggerRef(pg) // Manually triggering Vue's reactivity
return res
}
Yes, I love digging docs before starting anything 😅. It was super easy to setup and execute inside a final project, but then (as I often do) I wanted to wrap PGlite into a Nuxt module, taking advantage of project's So I wanted to try and create a composable-first, rather a component-first, approach. Something that, if successful, could be integrated in the official |
We could actually move this into a discussion, now that I think of it. My bad 🙄 |
Long story short: the current main classes for PGlite use a number of private methods, but since Vue's reactivity is based on proxying this effectively breaks its usability (official comment).
This becomes quite important when working with composables instead of components.
An example of an ideal DX composable would be:
Same applies for workers and in a Nuxt context.
The text was updated successfully, but these errors were encountered: