ember-osf-web icon indicating copy to clipboard operation
ember-osf-web copied to clipboard

Set async=false for all relationships.

Open jamescdavis opened this issue 7 years ago • 0 comments

We should set async=false for all relationships (see reference below). Since we are using decorators, an easy way would be just to define custom @hasMany and @belongsTo decorators that do this by default and import them in place of the ember-decorators decorators.

Having a guarantee that writing post.get('comments') in JavaScript or {{post.comments.length}} in Handlebars won't trigger any side effects is a big benefit for developers – synchronous templates and computed properties are straightforward and predictable. And if they do forget to load something, instead of having the template's rendering pass try to do it for them, the developer would just see missing data and go load it explicitly themselves somewhere, perhaps in a route or a component hook using an Ember Concurrency task.

Reference: https://embermap.com/notes/83-the-case-against-async-relationships

jamescdavis avatar Oct 01 '18 14:10 jamescdavis