Open baradhili opened 3 years ago
I did not migrate to vuejs 3 for now. I can't tell if it will work out of the box. looking at https://v3.vuejs.org/guide/migration/introduction.html I don't see anything that will break.
Maybe the data merging strategy for mixins should be checked: https://v3.vuejs.org/guide/migration/data-option.html#overview and the new emit options should be overseen too : https://v3.vuejs.org/guide/migration/emits-option.html
and The beforeDestroy lifecycle option has been renamed to beforeUnmount
For other people.. There are a bunch of steps to get pouchdb to import (nothing about working, simply to get past the import step!) in vue3/vite
<script>window.global = window</script>
optimizeDeps: {
allowNodeBuiltins: ['pouchdb-browser', 'pouchdb-utils']
},
and do yarn add events
then look at the above things
@elmatou I'll fork this repo to do this for the moment
ok I have something that loads in vue3.. a bit of changes in the way it plugin is exported and I suspect emits now are injects... I haven't written anything using it yet :)
HI @baradhili
Feel free to fork and make any PR you want. You are using Vite which bundle and load modules with Rollup as Vue-LCI uses Webpack. It is quite natural that it needs some tweaks.
I'll be very glad to review PR on vue3 support, it is the next step for every VueJS developer. As for Vite if it do not break Vue-CLI support I'll accept the PR too, just keep them separate for simplicity.
Hi, i am working on a PR on this, got it working so far, but I am not sure if I something is still broken -
Doing https://github.com/elmatou/vue-pouchdb-lite#reactive--live-selectors-mango-queries - using peopleInOtherDatabase, is setting person.name = "new Name"
supposed to change the doc in the db? If a remote DB is used (database: 'https://......../...'), should it update reactively by itself? (if not how would working directly with a remote db need to save changes?) I am not sure of the behavior -
In case you are interested: https://github.com/BananaAcid/vue3-pouchdb-lite ... feedback would be great
Hi, I have no Vue3 project currently to test this extensively.
The live selector only works for reading doc, as it often return an array for results, they are copied to the data object of the vue instance, and kept accurate when database changes.
If you want changes in doc to be saved in db on each change (which is not recommended with couchdb, as it keep a trace of any changes). You will need to save the record in a specific data object and set a watcher on it.
As it is not a very "lite" feature and not a recommended practice by couchdb, I will not merge this in the lib.
Thanks for the info. Have it in use with a project, works throughout as expected. Dependencies are still an issue (need to be forced to newest version using ncu -u
and then npm i --force
).
Just wondering if its possible to use this in vuev3?
Thanks