Last active
December 5, 2017 10:52
-
-
Save Allerby/9cc65347296b2670e560f0942735c96f to your computer and use it in GitHub Desktop.
Fastboot and Ember Concurrency?
This file contains hidden or 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
// Route | |
import Ember from 'ember'; | |
import { task } from 'ember-concurrency'; | |
export default Ember.Route.extend({ | |
// This won't work as Fastboot needs the model to be resolved on render. | |
// A promise could be used to wait for 'getPost' to resolve, but I would lose the usefulness of ember-concurrencies derived state. | |
model: function(params) { | |
return { | |
listing: this.get('getPost').perform(params.post_id), | |
}; | |
}, | |
getPost: task(function * (postId) { | |
return yield this.store.findRecord('post', postId) | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment