-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
Updated how we describe injecting Ember Data store #1541
Conversation
@@ -125,20 +125,18 @@ identifier, instead): | |||
Ember Data is a powerful (but optional) library included by default in new Ember apps. | |||
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/release/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/). | |||
|
|||
_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/release/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/release/classes/Route/methods/model?anchor=model) hook._ |
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.
Because the reader hasn't seen the code yet, I thought it'd be better to move this paragraph (an afterthought about Model
vs. model()
) after we present the code.
I very vaguely recall that we did the store injection on purpose in the code samples, and I don’t remember why. Could you reach out to the dev-ember-data channel to get feedback on this? Thanks! The wording changes seem great regardless. |
From what I remember, the Ember Data team would like to move away from having the store injected automatically in all the places. Long term, switching to specified injection (vs automated injection) likely leads to less error prone tree-shaking as app authors have “opted in” more clearly to using the store service |
Jen and David, thanks for providing feedback and additional context. I think it makes sense that, in Octane and going forward, we will want developers to begin practicing being more explicit with dependency injection. At the same time, I wonder if, until As an intermediate step, I think we can also consider the option of reviewing all pages in the Ember Guides (in v3.15 and above), to ensure that the injection of Yep, I will reach out to the |
@ijlee2 I think given the end desire expressed by the Ember Data team at the very end of the issue here (emberjs/data#6166) it’s probably wiser to be steering community members toward the new best practices that we want them to be using in the future. But yes, fully agreed that it should be standardized |
@acorncom Sounds good! When I get a chance, I'll check which pages don't currently show store injection. It's possible that all pages do and I can just revert the change that I made in this PR. |
I ran There are several places where we encourage implicit store injection. In a few other places, including the Super Rentals Tutorial, we do practice explicit store injection. Probably let's change implicit to explicit in a separate PR?
|
Closed by mistake. |
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.
This looks good to me! I am not totally clear on whether you wanted to do more work on this before merging, so I'm not merging yet. Feel free to push the green button if you are ready!
Thanks! I'll merge this PR and make a separate issue that asks for injecting the |
Description
Through a Discord conversation, I realized that we didn't explain well when a developer needs to inject the Ember Data store service:
I also noticed that the
Zoey says
has a Markdown typo (we unfortunately have to manually provide a<code>
tag).How to Review
I recommend reviewing commits one by one. Each commit makes the same type of change across different versions, starting with Ember 3.15 (Octane).
References
Zoey says...
towards the end)