-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
"Maximum call stack size exceeded." w/ ember && ember-data 2.11 beta #224
Comments
Looks like a really tight cycle at the very least. |
So this guy is definitely the culprit: emberjs/data@36bc08a . I've got some cycles to spend right now, I'll get this fixed up. I believe @runspired also has coming changes for ember-data, I'll see if I can investigate them and figure out what the impact is for this addon. Stay tuned. EDIT: The trick seems to be that ember-data now uses it's own |
@workmanw still supports, but the fallback logic moved into the cache (which already was a thing) |
@runspired the problem is that previously this addon could provide it's own fallback because Do you have any thoughts on a modification that could be made to allow a fallback to be passed in to |
I'd originally left the fallback logic outside of the cache but @igorT and I didn't like that this made the cache and the store need to be bound tightly together. Can you point me to what this fallback is / does? |
@workmanw looking through this library's code, I dont see anywhere you make calls into adapterFor. |
:( I'm sorry I said adapter ... I meant to say serializer. See here: https://github.com/lytics/ember-data-model-fragments/blob/master/addon/ext.js#L96-L102 You can see in that case the store is being monkey patched to enable Fragments to have their own default serializer. The design is that just as the store proper has it's own "application serializer" for models, fragments too can have a default fragment serializer. It's my impression that many apps, mine included, just use the "application serializer" as their default fragment serializer, but I definitely can't say that is definitive. |
It is likely that you can monkey patch this method: However I'm in favor of there being a public API for the fallbacks. If you'd open up an issue and are willing to work on an RFC I think this is something we can add and get in before beta goes to stable. |
@runspired I think monkey patching It sounds like you're suggesting a public API for all of ember-data to provide a public mechanism for fallback types. Is that right? Or were you suggesting a public mechanism just for the |
@workmanw I think the existing monkey patch you have could be ported fairly seamlessly. let instanceCache = store._instanceCache;
let _super = instanceCache.prototype._fallbacksFor;
instanceCache.prototype._fallbacksFor = function _monkeyPatchedFallbacksFor(namespace, preferredKey) {
if (namespace === 'serializer') {
let model = this._store._modelFor(preferredKey);
if (model && Fragment.detect(model)) {
return [
'-fragment',
'-default'
];
}
}
return _super(namespace, preferredKey);
}; |
This is correct, I suspect it would be something along the lines of: store.registerContainerFallback(cb) Although the more I think about it, we kinda want to disallow or discourage customization of the fallbacks, this should be opened as an issue on the ember-data repo for more people to contribute to the discussion. I want to support fragments but I don't particularly want to build APIs that are really only there for fragments specifically. |
@runspired D'oh! That would totally work. I just got it in my head it needed to be an argument. Thanks a lot for the back and forth here.
Honestly, I have to agree as well. I think it would be hard to explain the need for this outside the context of fragments or some other similar addon. In the year or so that I've been helping out with this addon I've tried to come up with ways to simplify the relationship, even if just for cognitive reasons. It's super tough because ember-data doesn't want to, and shouldn't have to, keep it's private APIs stable. On the other side, enough people use the addon, that value has clearly demonstrated. I think one of the brittle aspects of this addon is that we end up monkey patching things. If there was a more clean way to extend the Anyways, thanks again! |
I'm seeing this issue on the following versions:
Here's our log test log: https://circleci.com/gh/NYCPlanning/ceqr-app/1765 This issue appears to be closed... maybe it is resurfacing? Or maybe it's unrelated to model fragments. Here's a trace:
Edit: |
There are quite a few test failures with ember and ember-data beta. They all seem to be max call stack issues. I'll investigate in the next few weeks as I have time, but feel free to weigh in if anyone has thoughts.
The text was updated successfully, but these errors were encountered: