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

models is undefined #12845

Closed
mohlek opened this issue Jan 20, 2016 · 14 comments
Closed

models is undefined #12845

mohlek opened this issue Jan 20, 2016 · 14 comments

Comments

@mohlek
Copy link

mohlek commented Jan 20, 2016

I have another strange bug in ember.
Sometimes i get an error when switching routes.
TypeError: models is undefined.

This error doesn't happen all the times. And I can't reproduce it every time.
There is no way to reproduce it in a twiddle and my repo has to be private.

I could track that bug down to link-to but I don't know what triggers this sneaky bast***

Any ideas?

@mohlek
Copy link
Author

mohlek commented Jan 20, 2016

I made a pr which fixes this strange behavior. But I want to know why does that happen at all?

@buschtoens
Copy link
Contributor

Sounds like some kind of race-condition, if it doesn't happen consistently.

@stefanpenner
Copy link
Member

We need to see a reproduction of this issue, the proposed fix is overly defensive and likely is just hiding some other issue (in ember or your app)

@mohlek
Copy link
Author

mohlek commented Jan 20, 2016

I dont know if the stack trace helps..

computeLinkToComponentModelsAreLoaded()
 vendor.js:43922
ComputedPropertyPrototype.get()
 vendor.js:28745
get()
 vendor.js:34063
computeLinkToComponentLoading()
 vendor.js:43913
ComputedPropertyPrototype.get()
 vendor.js:28745
get()
 vendor.js:34063
LinkComponent<._computeActive()
 vendor.js:43735
computeLinkToComponentActive()
 vendor.js:43774
ComputedPropertyPrototype.get()
 vendor.js:28745
get()
 vendor.js:34063
i()
 vendor.js:46697
exports.default<.any()
 vendor.js:47237
exports.default<.isAny()
 vendor.js:47258
exports.default<.active<()
 vendor.js:133970
ComputedPropertyPrototype.get()
 vendor.js:28745
get()
 vendor.js:34063
exports.default<.compute()
 vendor.js:35211
BasicStream.prototype.value()
 vendor.js:35403
read()
 vendor.js:35770
getValue()
 vendor.js:22578
getArrayValues()
 vendor.js:25646
BuiltInHelperStream<.compute()
 vendor.js:25575
BasicStream.prototype.value()
 vendor.js:35403
read()
 vendor.js:35770
getValue()
 vendor.js:22578
getArrayValues()
 vendor.js:25646
BuiltInHelperStream<.compute()
 vendor.js:25575
BasicStream.prototype.value()
 vendor.js:35403
read()
 vendor.js:35770
getValue()
 vendor.js:22578
attribute()
 vendor.js:61695
AlwaysDirtyVisitor.attribute()
 vendor.js:62037
exports.default.attribute/<()
 vendor.js:62092
dirtyCheck()
 vendor.js:62117
exports.default.attribute()
 vendor.js:62091
RenderResult.prototype.populateNodes()
 vendor.js:62418
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.block()
 vendor.js:62067
RenderResult.prototype.populateNodes()
 vendor.js:62410
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
validateChildMorphs()
 vendor.js:62748
dirtyCheck()
 vendor.js:62122
exports.default.block()
 vendor.js:62067
RenderResult.prototype.populateNodes()
 vendor.js:62410
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.content()
 vendor.js:62079
RenderResult.prototype.populateNodes()
 vendor.js:62414
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.content()
 vendor.js:62079
RenderResult.prototype.populateNodes()
 vendor.js:62414
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.block()
 vendor.js:62067
RenderResult.prototype.populateNodes()
 vendor.js:62410
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.content()
 vendor.js:62079
RenderResult.prototype.populateNodes()
 vendor.js:62414
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.inline()
 vendor.js:62073
RenderResult.prototype.populateNodes()
 vendor.js:62412
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
handleKeyword()
 vendor.js:61393
handleRedirect()
 vendor.js:61322
inline()
 vendor.js:61465
AlwaysDirtyVisitor.content()
 vendor.js:62001
exports.default.content/<()
 vendor.js:62080
dirtyCheck()
 vendor.js:62117
exports.default.content()
 vendor.js:62079
RenderResult.prototype.populateNodes()
 vendor.js:62414
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.content()
 vendor.js:62079
RenderResult.prototype.populateNodes()
 vendor.js:62414
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.content()
 vendor.js:62079
RenderResult.prototype.populateNodes()
 vendor.js:62414
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
dirtyCheck()
 vendor.js:62122
exports.default.block()
 vendor.js:62067
RenderResult.prototype.populateNodes()
 vendor.js:62410
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
handleKeyword()
 vendor.js:61393
handleRedirect()
 vendor.js:61322
inline()
 vendor.js:61465
AlwaysDirtyVisitor.inline()
 vendor.js:61992
exports.default.inline/<()
 vendor.js:62074
dirtyCheck()
 vendor.js:62117
exports.default.inline()
 vendor.js:62073
RenderResult.prototype.populateNodes()
 vendor.js:62412
RenderResult.prototype.revalidateWith()
 vendor.js:62384
validateChildMorphs()
 vendor.js:62752
handleKeyword()
 vendor.js:61393
handleRedirect()
 vendor.js:61322
block()
 vendor.js:61283
AlwaysDirtyVisitor.block()
 vendor.js:61981
exports.default.block/<()
 vendor.js:62068
dirtyCheck()
 vendor.js:62117
exports.default.block()
 vendor.js:62067
RenderResult.prototype.populateNodes()
 vendor.js:62410
RenderResult.prototype.revalidateWith()
 vendor.js:62384
Block.prototype.invoke()
 vendor.js:62957
yieldKeyword()
 vendor.js:24855
handleKeyword()
 vendor.js:61336
handleRedirect()
 vendor.js:61322
inline()
 vendor.js:61465
AlwaysDirtyVisitor.inline()
 vendor.js:61992
exports.default.inline/<()
 vendor.js:62074
dirtyCheck()
 vendor.js:62117
exports.default.inline()
 vendor.js:62073
RenderResult.prototype.populateNodes()

@stefanpenner
Copy link
Member

I dont know if the stack trace helps..

Nope, we need a reproduction.

@buschtoens
Copy link
Contributor

@stefanpenner Could you provide some pointers? From where is the models property set?

@stefanpenner
Copy link
Member

It would appear that their exists an application where this behavior is manifesting, extracting that part of the application would be a great starting point for a reproduction.

Unfortunately, I am asking for a reproduction because I have no idea how this issue is happening. Without further context, this isn't actionable. So I am requesting more context, once provided I will happily dive in.

@mohlek
Copy link
Author

mohlek commented Jan 21, 2016

Unfortunately I am not allowed to disclose the source code of our app (corporate policies). The app has grown so big, that I cannot easily just reproduce it. Especially since the API response appears to play an important role.

I'll look into this in greater detail and will try to find cause.

I'm now able to reliably trigger the error, however this only works in one of our dev VMs. All other machines don't appear to have a problem. I diffed the js assets and they are exactly the same on all machines.

All machines run the same version of Linux and the same version for Firefox and chrome.
I really don't know what the heck is going on.

@stefanpenner
Copy link
Member

@mohlek my guess, is that it isn't a bug in link-to rather a legit race condition in your app. That is just a gut feeling, but Is likely work further investigation.

Maybe their is something we can do on our side (as link-to could totally use some more tlc), but that will require some guess/check.

@pixelhandler
Copy link
Contributor

@mohlek I also work with code that may not be shared publicly but when I run in to a major bug in my app I try to reproduce an example code repository on github so the Ember contributors can reproduce my error and fix any potential bugs in the framework. I know it's a bit of work, but if you have no workaround that has been the best course of action for me.

@remkoboschker
Copy link

perhaps this issues is related #12969

@mohlek
Copy link
Author

mohlek commented Mar 11, 2016

The current Ember version 2.4.2 seems to fix my problem.
Couldn't reproduce the bug with this version.
Version 2.3.1 triggered instantly.

However. Since this bug doesn't showed up for a while now (In version 2.4.2) I won't spend any further time on it.

Thanks everyone for contribution

@mohlek mohlek closed this as completed Mar 11, 2016
@typeoneerror
Copy link

Same issue here in 2.4.5. Having a tough time repro'ing outside our application, but same stack trace as @mohlek.

@typeoneerror
Copy link

So, I found that I had an "index" route that was redirecting to another route. I was not including the parent route's model in the transition. It worked some of the time, i.e....

// course/route.js
model() {
  return this.store.findRecord('course', params.course_id);
}
// course/index/route.js
beforeModel() {
  this._super(...arguments);
  this.transitionTo('course.curriculum');
}

If I update beforeModel in course/index/route.js to do this, the error goes away:

beforeModel() {
    this._super(...arguments);
    const course = this.modelFor('course');
    this.transitionTo('course.curriculum', course);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants