-
-
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
refactor store managed instances #3191
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f5c29e3
to
7251ef2
Compare
@@ -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 |
There was a problem hiding this comment.
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
...
7251ef2
to
b4d9033
Compare
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
b4d9033
to
ee97760
Compare
fivetanley
added a commit
that referenced
this pull request
Jun 4, 2015
refactor store managed instances
👍 |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toadapter:application
,this lookup is cached. So, if you look up
adapter:post
again, thatinstance will actually be cached. Previously, we did the lookup for
adapter:post
every time.This also removes passing factories as the
adapter
property toDS.Store.
closes #3050