-
Notifications
You must be signed in to change notification settings - Fork 52
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
Problem to $persist #135
Comments
For Vuex ORM the key of model is attribute "$id" as we can see in: vuex-orm/query/Query.ts
When the model has increment id, its set to "$id" and "id" attributes the key value, but when the model doesnt have increment id , its set the fictitious key only to "$id" attribute. Then, the plugin cant get data by "id" attribute on: plugin-graphql/orm/model.ts
In where should be "$id". Another problem, its seems possible in Vuex ORM have more then one attribute as model key and plugin graphql is not prepered for this situation, as we can see in: Vuex ORM/model/Model.ts
|
@vuex-orm/core 0.34 solves the problem of null id, because Uid generate to $id and id attributes. But the plugin still dont work with composite keys |
With the latest release, the plugin works with Vuex-ORM 0.36. Feel free to reopen the issue when the problem still exists :) |
Thank you very much for the update =] |
This is still an issue as it tries to convert a plugin-graphql/src/orm/model.ts Line 267 in 50d0bb6
|
I am using string ids in many of my models. Hat to fork the Repo and remove all "toNumber" calls in the code. Hope it will be fixed soon |
With generated Seems that now (vuex-orm/core 0.36.3) it not prefixed with But in plugin code we have getRecordWithId(id) {
return this.baseModel
.query()
.withAllRecursive()
.where("id", toPrimaryKey(id))
.first();
} where function toPrimaryKey(input) {
if (input === null)
return 0;
if (typeof input === "string" && (input.startsWith("$uid") || isGuid(input))) {
return input;
}
return parseInt(input.toString(), 10);
} Why you need that conversion in plugin? Just return string if that is string! |
I dont know why I cant persist and object... I got:
fetch, push and destroy works well.
Sector,js
store/index.js
Sector.vue
The text was updated successfully, but these errors were encountered: