ember-concurrency
ember-concurrency copied to clipboard
Should being able to do a .then on the result of a .perform be doc'd?
I randomly tried doing a .then
on the execution of a task and was pleasantly surprised it worked. I couldn't find documentation on it which makes me worried that it might go away.
This functionality is here to stay, as it is very important for interop with the rest of the non-Task world.
I suppose we could improve the docs surrounding this functionality but I'd worry that people would start using someTask.perform().then(() => {...})
from within another task function, which is bad because .then()
in a task function is often an anti-pattern and anything you yield
that has a .then()
can't be cancelled immediately in the same way tasks can.
My use-case was having the code that performed the task
be reusable in the model hook but I couldn't make the model hook a task
@SirZach that sounds like a perfectly reasonable use case to add to the docs 👍
Cool, I'll try and spin up PR this weekend to document it. Thanks!