Ember Data: Return Promise from DS.Model.save()#362
Ember Data: Return Promise from DS.Model.save()#362fivetanley wants to merge 2 commits intoemberjs:masterfrom
Conversation
|
This is great! |
|
In my opinion And I'm not sure if I like the idea to change the result of |
|
@luxferresum We should not prevent progress in one area because of a preference for fixing issues other areas.
Implementation problems with save (in addition to the usage issues mentioned in the RFC)
Solutions for issues with finders are en-route, but doing it all at once would be far more disruptive.
Many other record APIs return promises or the record instead of a PromiseProxy. With the exception of |
|
This looks great to me as well. @runspired we should discuss this at the next meeting if we haven't already |
|
Chatted about this in todays ember-data meeting, the general consensus is that we'd like to move forward. |
|
Discussed during today's meeting; we've already agreed this looks like a good path forward; putting it in FCP. |
|
COOL https://github.com/pete-the-pete/data/tree/promise-after-save <--
hopefully that can come in handy.
…On Wed, Aug 21, 2019 at 2:23 PM David J. Hamilton ***@***.***> wrote:
Discussed during today's meeting; we've already agreed this looks like a
good path forward; putting it in FCP.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#362?email_source=notifications&email_token=AACUPAL3OCUOCLRPYBC4K4DQFWW5HA5CNFSM4FRBVJUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43FO3A#issuecomment-523655020>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACUPAJAZBDXLUFZE66BDDLQFWW5HANCNFSM4FRBVJUA>
.
|
|
I think this might be a good opportunity to do the same refactoring for |
|
This has been in FCP for months? |
|
After discussion today we decided that the return value here needs to be a custom thenable, basically a We are otherwise 👍 on merging this |
|
Ping |
|
I'll mention at the next meeting that we forgot to merge, we should go ahead and merge :) |
|
|
||
| ## Unresolved questions | ||
|
|
||
| * It's quite possible Ember Data users use the isSettled, isRejected, isFulfilled, and isPending properties of the PromiseProxyMixin to display state in their UI. For example, you may have a component that calls record.save(), and uses isPending to show a loading spinner or isRejected to show UI for error states. Should we point them to community alternatives like [ember-promise-helpers](https://github.com/fivetanley/ember-promise-helpers) or [ember-concurrency](http://ember-concurrency.com/docs/introduction/) in the deprecation message for these properties? |
There was a problem hiding this comment.
We could also implement something on top of Promise that exposes these flags.
There was a problem hiding this comment.
I guess their method could be wrapped with something similar to this or ember-concurrency as well. Almost every save we deal with uses derived state to help the UI along and prevent user initiated bugs.
So I take that back. Returning a simple Promise is better.
snewcomer
left a comment
There was a problem hiding this comment.
Will start working on this one! Will have to figure out how to update to get CI to pass. Or we just dup it to a new RFC.
|
supplanted by #795! |
Rendered