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

refactor store managed instances #3191

Merged
merged 1 commit into from
Jun 4, 2015

Conversation

fivetanley
Copy link
Member

In this commit, we refactor store managed instance lookups to have its
own class that takes the store's container. This moves a large portion
of code out of the store and instead uses delegation.

There's also a performance benefit:

If you look up adapter:post and fallback to adapter:application,
this lookup is cached. So, if you look up adapter:post again, that
instance will actually be cached. Previously, we did the lookup for
adapter:post every time.

This also removes passing factories as the adapter property to
DS.Store.

closes #3050

@fivetanley fivetanley force-pushed the refactor-serializer-adapter-lookup branch 3 times, most recently from f5c29e3 to 7251ef2 Compare June 4, 2015 03:52
@@ -1958,30 +1943,28 @@ Store = Service.extend({
@private
@param {String} modelName the object modelName
@param {String} name the object name
@param {Object} fallback the fallback object to return if the lookup for modelName or 'application' fails
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{Array} fallbacks the list of the fallback objects...

@fivetanley fivetanley force-pushed the refactor-serializer-adapter-lookup branch from 7251ef2 to b4d9033 Compare June 4, 2015 14:40
In this commit, we refactor store managed instance lookups to have its
own class that takes the store's container. This moves a large portion
of code out of the store and instead uses delegation.

There's also a performance benefit:

If you look up `adapter:post` and fallback to `adapter:application`,
this lookup is cached. So, if you look up `adapter:post` again, that
instance will actually be cached. Previously, we did the lookup for
`adapter:post` every time.

This also removes passing factories as the `adapter` property to
DS.Store.

closes #3050
@fivetanley fivetanley force-pushed the refactor-serializer-adapter-lookup branch from b4d9033 to ee97760 Compare June 4, 2015 14:41
fivetanley added a commit that referenced this pull request Jun 4, 2015
@fivetanley fivetanley merged commit f4eefab into master Jun 4, 2015
@fivetanley fivetanley deleted the refactor-serializer-adapter-lookup branch June 4, 2015 14:50
@igorT
Copy link
Member

igorT commented Jun 4, 2015

👍

HeroicEric added a commit to HeroicEric/data that referenced this pull request Aug 19, 2019
From emberjs#6166

This refactors some tests so that they don't rely on the `createStore`
test helper.

`createStore` was helpful in the past but is less so now that we have
[nice APIs for dependency injection](https://guides.emberjs.com/release/applications/dependency-injection/).

---

One test was removed from `unit/store/adapter-interop - Store working
with a Adapter` because I don't think it was correct.

Here was the test:

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/unit/store/adapter-interop-test.js#L28-L32

This test was, at one time, testing that it was possible to pass a
factory as the `adapter` property to `Store`. This feature was removed
in emberjs#3191 but the test continued
passing because of the way the `createStore` works.

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/helpers/store.js#L57-L60
HeroicEric added a commit to HeroicEric/data that referenced this pull request Aug 19, 2019
From emberjs#6166

This refactors some tests so that they don't rely on the `createStore`
test helper.

`createStore` was helpful in the past but is less so now that we have
[nice APIs for dependency injection](https://guides.emberjs.com/release/applications/dependency-injection/).

---

One test was removed from `unit/store/adapter-interop - Store working
with a Adapter` because I don't think it was correct.

Here was the test:

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/unit/store/adapter-interop-test.js#L28-L32

This test was, at one time, testing that it was possible to pass a
factory as the `adapter` property to `Store`. This feature was removed
in emberjs#3191 but the test continued
passing because of the way the `createStore` works.

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/helpers/store.js#L57-L60
HeroicEric added a commit to HeroicEric/data that referenced this pull request Aug 19, 2019
From emberjs#6166

This refactors some tests so that they don't rely on the `createStore`
test helper.

`createStore` was helpful in the past but is less so now that we have
[nice APIs for dependency injection](https://guides.emberjs.com/release/applications/dependency-injection/).

---

One test was removed from `unit/store/adapter-interop - Store working
with a Adapter` because I don't think it was correct.

Here was the test:

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/unit/store/adapter-interop-test.js#L28-L32

This test was, at one time, testing that it was possible to pass a
factory as the `adapter` property to `Store`. This feature was removed
in emberjs#3191 but the test continued
passing because of the way the `createStore` works.

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/helpers/store.js#L57-L60
HeroicEric added a commit to HeroicEric/data that referenced this pull request Aug 20, 2019
From emberjs#6166

This refactors some tests so that they don't rely on the `createStore`
test helper.

`createStore` was helpful in the past but is less so now that we have
[nice APIs for dependency injection](https://guides.emberjs.com/release/applications/dependency-injection/).

---

One test was removed from `unit/store/adapter-interop - Store working
with a Adapter` because I don't think it was correct.

Here was the test:

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/unit/store/adapter-interop-test.js#L28-L32

This test was, at one time, testing that it was possible to pass a
factory as the `adapter` property to `Store`. This feature was removed
in emberjs#3191 but the test continued
passing because of the way the `createStore` works.

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/helpers/store.js#L57-L60
HeroicEric added a commit to HeroicEric/data that referenced this pull request Aug 22, 2019
From emberjs#6166

This refactors some tests so that they don't rely on the `createStore`
test helper.

`createStore` was helpful in the past but is less so now that we have
[nice APIs for dependency injection](https://guides.emberjs.com/release/applications/dependency-injection/).

---

One test was removed from `unit/store/adapter-interop - Store working
with a Adapter` because I don't think it was correct.

Here was the test:

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/unit/store/adapter-interop-test.js#L28-L32

This test was, at one time, testing that it was possible to pass a
factory as the `adapter` property to `Store`. This feature was removed
in emberjs#3191 but the test continued
passing because of the way the `createStore` works.

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/helpers/store.js#L57-L60
runspired pushed a commit that referenced this pull request Aug 22, 2019
From #6166

This refactors some tests so that they don't rely on the `createStore`
test helper.

`createStore` was helpful in the past but is less so now that we have
[nice APIs for dependency injection](https://guides.emberjs.com/release/applications/dependency-injection/).

---

One test was removed from `unit/store/adapter-interop - Store working
with a Adapter` because I don't think it was correct.

Here was the test:

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/unit/store/adapter-interop-test.js#L28-L32

This test was, at one time, testing that it was possible to pass a
factory as the `adapter` property to `Store`. This feature was removed
in #3191 but the test continued
passing because of the way the `createStore` works.

https://github.com/emberjs/data/blob/39182f324d5777e4a75c4a582f0791631e37d8de/packages/-ember-data/tests/helpers/store.js#L57-L60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Resolving an adapter-less model should cache the 'application adapter' resolution.
3 participants