can-connect icon indicating copy to clipboard operation
can-connect copied to clipboard

Unable to get single record by passing the ID in .get

Open obaidott opened this issue 9 years ago • 5 comments

When trying to get a record in model via:

return ContributionMonth.get( this.contributionMonthId );

I get a failure after receiving the response back from the server.

I get the following error:

contribution-month.js:30 Error loading contribution month:  TypeError: Cannot use 'in' operator to search for '__get' in 57bde3b71cad166f3da559d2
    at readObservabe (http://localhost:3030/node_modules/can-connect/src/can/map/map.js:724:13)
    at Object.id (http://localhost:3030/node_modules/can-connect/src/can/map/map.js:68:16)
    at http://localhost:3030/node_modules/can-connect/src/fall-through-cache/fall-through-cache.js:256:57
    at http://localhost:3030/node_modules/can-zone/lib/tasks.js:109:15
    at Task.run (http://localhost:3030/node_modules/can-zone/lib/zone.js:39:17)
    at Zone.runTask (http://localhost:3030/node_modules/can-zone/lib/zone.js:176:14)
    at http://localhost:3030/node_modules/can-zone/lib/zone.js:270:15
    at http://localhost:3030/node_modules/can-zone/lib/tasks.js:121:21
    at tryCatchReject (http://localhost:3030/node_modules/when/es6-shim/Promise.js:1183:30)
    at runContinuation1 (http://localhost:3030/node_modules/when/es6-shim/Promise.js:1142:4)

cc: @marshallswain

obaidott avatar Aug 24 '16 18:08 obaidott

@justinbmeyer, currently with can-connect-feathers, doing ContributionMonth.get(1) would translate to a URL like /contribution_months/1. It currently doesn't support doing ContributionMonth.get({_id:1}). Should it? Update: it does, now, thanks to @obaidott

marshallswain avatar Aug 24 '16 18:08 marshallswain

Ok so I think the issue was with localStorage cache causing issues. Once I cleared everything and tried it again, it all worked as expected.

obaidott avatar Aug 24 '16 18:08 obaidott

I am going to write some tests to make sure this is not an issue. I will re-open this ticket if needed.

obaidott avatar Aug 24 '16 18:08 obaidott

Ok, so this is also happening in Ref type. We pass the ID as a object when making the request and it is not working properly.

obaidott avatar Aug 24 '16 20:08 obaidott

@obaidott can you elaborate what you mean? Can you create an example?

justinbmeyer avatar Sep 01 '16 16:09 justinbmeyer