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

upd(configure:ember): add writeup on default-async-observers #1215

Merged
merged 16 commits into from
Dec 20, 2019

Conversation

jayjayjpg
Copy link
Contributor

@jayjayjpg jayjayjpg commented Dec 19, 2019

This should add a section documenting the use of the default async observer optional feature as described in RFC#494: emberjs/rfcs#494

Copy link
Contributor Author

@jayjayjpg jayjayjpg left a comment

Choose a reason for hiding this comment

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

Screenshot 2019-12-19 at 21 11 11

Person.reopen({
partOfNameChanged: observer({
dependentKeys: ['firstName', 'lastName'],
function() {
Copy link
Contributor Author

@jayjayjpg jayjayjpg Dec 19, 2019

Choose a reason for hiding this comment

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

Is the code example correct here, or should it rather be

Suggested change
function() {
fn() {

I couldn't find any documentation on it (which seems to be the reason for this PR 😅 )

Copy link
Contributor

Choose a reason for hiding this comment

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

It is indeed supposed to be named fn

Also, the RFC has a bit of detail on the exact signature too https://github.com/emberjs/rfcs/blob/master/text/0494-async-observers.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Super, thank you for the reference 🙇‍♀

```

While the `default-async-observers` feature is only enabled by default in modern Ember applications,
you can enable this optional feature in older apps (Ember 3.13+) as follows:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if you find it more useful to just skip this part of the phrase referring to the old behaviour. If we skip this part, we could also just show how to disable the feature in current Ember apps in the code example below

@jayjayjpg jayjayjpg requested a review from a team December 19, 2019 20:16
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
Person.reopen({
partOfNameChanged: observer({
dependentKeys: ['firstName', 'lastName'],
function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is indeed supposed to be named fn

Also, the RFC has a bit of detail on the exact signature too https://github.com/emberjs/rfcs/blob/master/text/0494-async-observers.md

guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
jayjayjpg and others added 10 commits December 19, 2019 21:24
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>

With this feature *enabled*, Ember will run all observers in the application
asynchronously by default. This leads to observers running in the runloop
after the one in which the properties it observers were updated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
after the one in which the properties it observers were updated.
_after_ the one in which the observed properties were updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, why I'm not able to apply this suggestion anymore, but I added it now in a separate commit - thank you for the update 🙇‍♀

guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
guides/release/configuring-ember/optional-features.md Outdated Show resolved Hide resolved
@jenweber jenweber merged commit cc3c5cc into ember-learn:octane Dec 20, 2019
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.

3 participants