[v2 backport] Pass owner instead of registry to ember-data's setupContainer#1388
[v2 backport] Pass owner instead of registry to ember-data's setupContainer#1388anehx wants to merge 2 commits intoemberjs:v2-xfrom
Conversation
The `setupContainer` function of `ember-data` expects an application instance to be passed - in this case that is the faked owner object that we create when using a custom resolver in tests. This behaviour previously worked because `ember-data` supported the usage of legacy function `optionsForType` which exists on the `registry` object. However, they removed that legacy fallback in v4 and replaced it with `registerOptionsForType` which does not exist on the registry but only on the owner. Resolves emberjs#1386
9ea2f49 to
8867c01
Compare
8867c01 to
9500d0b
Compare
|
@chriskrycho @MelSumner The tests for release, beta and canary will always fail here since this v2 of this addon still uses Can someone support me with this? We currently can't update |
| // here; also see https://github.com/emberjs/data/issues/4071 for context | ||
| let setupContainer = require('ember-data/setup-container')['default']; | ||
| setupContainer(registry || container); | ||
| setupContainer(owner); |
There was a problem hiding this comment.
This likely needs some variety of version detection to pass the appropriate bits from Ember depending on its version (and potentially depending on the Ember Data version as well?). I don't have the relevant context there, but based on the test failures for older versions of Ember, I think that's the likely issue.
However, given v3 is out now, it is almost certainly better to upgrade to that instead of trying to do this, if at all possible!
The
setupContainerfunction ofember-dataexpects an application instance to be passed - in this case that is the faked owner object that we create when using a custom resolver in tests.This behaviour previously worked because
ember-datasupported the usage of legacy functionoptionsForTypewhich exists on theregistryobject. However, they removed that legacy fallback in v4 and replaced it withregisterOptionsForTypewhich does not exist on the registry but only on the owner.Resolves #1386