canjs / can-connect-feathers

The FeathersJS client library for DoneJS and can-connect
https://canjs.com/doc/can-connect-feathers.html
MIT License
10 stars 4 forks source link

Looking for idProp when docs say it it no longer needed. #136

Open MarcGodard opened 5 years ago

MarcGodard commented 5 years ago

The canjs docs say idProp is not needed when you do the following:

const Model = DefineMap.extend('Model', {
  _id: { identity: true, type: 'string' },

and:

let queryLogic = new QueryLogic(Model, {...})

in my model. but getting the following error when I do PageItem.get(item._id).then(data => {...}) and item is a PageItem item from its list.

Uncaught Error: An idProp was not set in the Model for [object Object]. Things may not work as expected.
    at getIdProp (service.js:15)
    at Behavior.getData (service.js:45)
    at Behavior.behavior.(:8080/anonymous function) [as getData] (http://localhost:8080/node_modules/can-connect/data/parse/parse.js:325:32)
    at Behavior.get (constructor.js:183)
    at Behavior.get (store.js:645)
    at Function.eval [as get] (map.js:674)
    at DefineMap.editPageItem (news.js:101)
    at {{scope.top.editPageItem(localhost/)}} (http://localhost:8080/node_modules/can-stache/expressions/call.js:100:16)
    at Call.value (call.js:112)
    at on:click="scope.top.editPageItem(localhost/)" (http://localhost:8080/node_modules/can-stache-bindings/can-stache-bindings.js:113:20)
justinbmeyer commented 5 years ago

Seems to work here: https://codepen.io/justinbmeyer/pen/zMKOQe?editors=1010

Which version of things are you using?

MarcGodard commented 5 years ago

"can-connect-feathers": "^5.0.0" "can": "^5.16.3" "can-connect": "^3.0.4"

Also posted here, because I found that was where the code was looking for the idProp https://github.com/canjs/can-connect-feathers/issues/134

https://github.com/canjs/can-connect-feathers/blob/0e90f1177e2ca262968bb166d34f5afa1b62f853/service/service.js#L4

MarcGodard commented 5 years ago

I also noticed other issues with the can-connect-feathers when the isProp is missing. When I added it to my models everything worked. Maybe the docs should reflect that when you are using feathers, to not remove the isProp in the model.

justinbmeyer commented 5 years ago

I think feathers just needs to be fixed

MarcGodard commented 5 years ago

Is can-connect-feathers a feathers lib or a bitovi lib?

matthewp commented 5 years ago

Bitovi.