Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4830

What are the advantages of async relationships?

$
0
0

@phcoliveira wrote:

First of all, this is an honest question. If there are advantages in using async relationships, I'm just failing to see them.

Handling the promises in templates is easy thanks to Handlebars, which is smart enough to get a property from the resolved value of a promise instead of the promise itself:

{{#with user.bestFriend as |friend|}}
  {{friend.nickname}}
{{/with}}

But things get hairy when these promises are passed to helpers and actions:

{{#with user.bestFriend as |friend|}}
  <button {{action "sendHi" friend}}>Send Hi!</button>
{{/with}}

...

actions : {
  sendHi(friend) {
    // friend.content
  }
}

So, I am very inclined to refactor my code using synchronous relationships. But what will I be missing?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles