Skip to content
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

[1.13.6 Regression] RESTAdapter.findRecord does not accept a list of records anymore #3587

Closed
dschmidt opened this issue Jul 26, 2015 · 4 comments

Comments

@dschmidt
Copy link

Hey,

my server returns a list of records for findRecord requests, which used to work just fine up until 1.13.6.

E.g.:
/artist/45

{
  artists: { id: 45, name: 'Foobar' } 
}

triggers now

TypeError: Cannot read property '_internalModel' of undefined

here: https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/store/finders.js#L32

For now I worked around it like this:

   const pluralize = Ember.Inflector.inflector.pluralize.bind(Ember.Inflector.inflector);

   [...]

    findRecord(store, typeClass, id, internalModel, options) {
        return this._super(...arguments).then((response) => {
            const modelName = internalModel.modelName;
            if(!response[modelName] && response[pluralize(modelName)]) {
                response[modelName] = response[pluralize(modelName)][0];
                response[pluralize(modelName)].shift();
            }

            return response;
        });
    },
@fivetanley
Copy link
Member

It looks like @bmac released 1.13.7. Can you try with that? Thanks.

@bmac
Copy link
Member

bmac commented Jul 27, 2015

fwiw I don't think 1.13.7 contains a fix for this bug.

@dschmidt
Copy link
Author

Right now I cant reproduce with neither 1.13.6 nor 1.13.7. It appears it's not triggered at all by calling findRecord on the store at all, but only with side-loading individual records - which I don't remember where I triggered this the last time in my app.

Maybe #3554 this could have any effect on this?
Then I would be fine with closing this until I run into it again with 1.13.7 - or can anyone else reproduce?

@wecc
Copy link
Contributor

wecc commented Jul 29, 2015

I don't think #3554 should impact this. Weird 😕

I'm closing this but will happily reopen if issue can be reproduced.

@wecc wecc closed this as completed Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants