Open fsvieira opened 4 years ago
It should. The feature is not very used though. Sometimes nameless imports seem not to perform the side effects they are supposed to (depending on webpack config etc).
So just to nail the issue down further, you could also try if there would be a difference if you'd import the addons into a variable and provide them in the constuctor of Dexie:
import dexieObservable from 'dexie-observable';
import dexieSyncable from 'dexie-syncable';
const db = new Dexie("taskroulette", {addons: [dexieObservable, dexieSyncable]});
If there's a difference, the reason must be something prohibiting the addons from being registered correctly. Package versioning could be a problem here - for example if the addons depend on dexie@2.x and you have dexie@3.x - then the addons may register themeselves on another instance of 'dexie' module. We might need to look into it to deliver addons that accepts dexie@3 if so.
If there's no difference, the feature could be broken in the latest version of the addons/dexie.
What version numbers of the addons and dexie are you using?
Hi,
Maybe the problem is that I am not using webpack, I am using parcel.
My versions are:
"dexie": "^2.0.4",
"dexie-observable": "^1.0.0-beta.5",
"dexie-syncable": "^1.0.0-beta.4"
I have been using feature .on("changes", ...) and its working so I think the observable may have registered and syncable two.
I tried your suggestion on the addons and seems to give me the same error on insert.
Next I am going to try to update to dexie@3.x
The feature is not very used though.
So how people are using the sync? Right now I am using something like "&taskID, ..." and then using uuidv4 to generate my ids, I am preparing the application to start developing server side sync code. My problem with this approach is that syncable seems to already have a uuid generator and I didn't want to have duplicated functions.
Thanks, I am loving dexie, thanks for making such cool project.
I think it can be wise to continue using your own id generating function so you can control it on both ends. But as we have the feature we should make sure it works as intended. Keeping this issue open.
Ok,
I tried to update to dexie 3 using npm and install the current master branch, but got some errors, and I think I would have to update observable and syncable.
So I was unable to test version dexie@3. I can continue with my uuidv4 ids, no problem, so my problem may be solved with that.
What can I do to help? My code is here https://github.com/fsvieira/taskroulette/blob/fv-dexie/src/db/db.js , don't know if it helps, you can see all configurations that I have.
Thanks.
Hi,
when using example from https://dexie.org/docs/Observable/Dexie.Observable all in html, it works ... $$uuid
shows ...
when using a index.html
referencing a webpack ./src/observable.js -o dist/bundle.js
with same code I get ...
Unhandled rejection: NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found. transaction@[native code]
thanks
without using { addons: [dexieObservable, dexieSyncable] }
I get
TypeError: Attempting to change the getter of an unconfigurable property.
and with I get the
Unhandled rejection: NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found. transaction@[native code]
above was on osx:safari when on osx:chrome using { addons: [dexieObservable, dexieSyncable] }
brings JOY ... $$uuid
works ...
without on osx:chrome Uncaught TypeError: Cannot redefine property: _localSyncNode
I noticed this issues too. For now I am using Dexie.Observable.createUUID()
as suggested also here: https://www.bountysource.com/issues/60515733-transactioninactiveerror-if-uuid-is-used-in-angular
Tested with dexie@3.0.1 dexie-observable@1.0.0-beta.7 dexie-syncable@1.0.0-beta.7
Still not working?
I've got the same error.
When you put to the db here, you dont provide a taskId and it shouldnt (I guess) since you want it automatically filled. but you provide a keyPath: tasks: "$$taskID,...
which - if I understand the [docs](https://dexie.org/docs/Version/Version.stores()) correctly - would mean that taskID must be present in the object.
I tried with '$$,...' but this unfortunately gives me the same error.
Please correct me if I am wrong.
Hi, I am trying to follow the sync tutorial/documentation, if I use put with taskID filled it works, but if I don't provide the taskID it gives me the error:
By using $$, shouldn't be automatically generated a UUID ?
Thanks.