-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
constructor.modelName is null in 2.12.1 #4923
Comments
I've been seeing this as well. Are you using Emberfire in your project? I noticed that some of my requests seem to now be routing through the ember fire adapter (possibly a different issue) and they use the following code which causes the issue.
The weird part for me is it doesn't happen 100% of the time so I am still digging into the code. |
@BryanCrotaz and @cloke, I've been trying to reproduce the issue locally but so far have been unsuccessful. If you get any closer to identifying a reproduction test case I would appreciate it. |
I'm not using EmberFire, but we have similar code. As a workaround use
|
The key thing here is which Ember version. cc @bmac @BryanCrotaz @cloke |
We are on version 2.12.1. It seems like it appeared in in 2.12, but I am not 100% certain. It's been a really weird one to track down. We have a fix in place for our code, but it becomes a problem with a few of our add-ons like EmberFire. |
@cloke just to confirm Ember 2.12.x |
[Debug] DEBUG: Ember: 2.12.1 |
This seems a tad tricky without a reproduction. If we can be provided one, this should be more actionable to diagnose. |
This is likely an issue with the factoryFor changes and emberfire. We had this issue with ember-data-model-fragments. I bet if you search emberfire, you'll find it's looking up and/or registering a new factory. Possibly related to: #4810 EDIT: Actually maybe I'm wrong here. A quick search of their code base didn't turn up any usage of |
It's not emberfire. We're not using it. We are doing a lot of store.push though |
@BryanCrotaz D'oh. I'm sorry. I read the messages out of order via email and it got stuck in my head you were. |
There's a known issue with 2.12 + 2.12 with modelName's being wrong for re-exports (or multiple registrations of the same base model). TL;DR last one in wins. However, the only cases I've found where https://ember-twiddle.com/0ce04900a6219d8dd18d2ddeafaa9658?openFiles=templates.application.hbs%2C Against Ember Data 2.12 Using Ember: 2.9.1: 👍 This was expected. I wonder if this is the behavior folks are hitting. |
modelName2 in your example is where I'm seeing null |
I ended up reverting back to ember and data 2.11 and all my issues went away. The issue revolves around a situation where record.constructor.modelName is null in 2.12 and not in 2.11. I am able to work around that in my own code, but some of the add-ons we use also use record.constructor.modelName which made working around the problem much more difficult. |
@cloke did you see this in ED 2.12 with Ember 2.11? Because if so that would conclusively point us to there being a separate issue to any known ones. |
@runspired I just updated ED to 2.12, but left ember to 2.11 and the issue returned. record.constructor.modelName with this combination becomes null. |
@cloke if you wouldn't mind, could we screenhero tomorrow and throw a debugger on one of these? |
I might have a similar issue because queries resolve, but the content is empty, even though the payload had the data. Works in ED 2.11.x but not in 2.12 with Latest Ember version. |
@knownasilya the easy fix is if you are re-exporting the same model multiple places, change it like so:
becomes.
|
(also fwiw this fix is also what the deprecation you will soon receive will tell you to do and do for you) |
+1 |
Related but stalled PR: #4886 |
Closing as modelName issues have been resolved. |
Seeing this on objects
push
ed into the store. Don't have a full robust reproduction step yet, but I've now seen this across four different apps.model.constructor.modelName
is nullmodel._internalModel.modelName
is correctThe text was updated successfully, but these errors were encountered: