-
-
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
Simplify store.adapterFor
and store.serializerFor
.
#5300
Simplify store.adapterFor
and store.serializerFor
.
#5300
Conversation
Use an inline series of lookups (instead of `ContainerInstanceCache`)
This was previously being done by ContainerInstanceCache (when it would look up an instance, it would always `set(instance, 'store', store)`), but the DI system can already do this for us automatically. This simplifies adapter / serializer testing quite a bit...
There is no reason to have them be non-singleton since we were already caching in the `ContainerInstanceCache`...
I created a tracking issue (adopted-ember-addons/ember-data-model-fragments#285) in ember-data-model-fragments... |
I chatted with @bmac offline, and there was some concern around the change making adapters and serializers singletons. Specifically, the move away from being singletons was done in order to support having different adapters and serializer instances with multiple store services (where each store got its own adapter and serializer instances). There were no tests to that effect, however it would be fairly easy to revert that small subsection here. I am concerned about lack of proper test coverage if this is actually feature to the system... |
Ember Data 3.0 removed the ContainerInstanceCache class which we were (prior to this patch) monkey-patching to override the default serailizer fallback lookup. This PR goes back to a similar approach to what ember-data-model-fragments was using prior to ember-data 2.11 (when ContainerInstanceCache was added) For a bit of context here is the patch that introduced the monkey-patch for Ember Data 2.11: adopted-ember-addons@a856c24 And here is the patch that remove ContainerInstanceCache class from Ember Data making the aforementioned monkey patch throw in 3.0: emberjs/data#5300 This PR ensures that the correct serializer is looked up as per the tests.
adapterFor
andserializerFor
ContainerInstanceCache