-
-
Notifications
You must be signed in to change notification settings - Fork 850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async recipes #307
Async recipes #307
Conversation
Drafts won't be revoked until the returned promise is fulfilled or rejected.
77fc705
to
edda437
Compare
Heads up, I force-pushed to remove the merge commit and reword the createDraft/finishDraft commit so it shows up on the Releases page. |
Oww sorry, yes I should read up on the new commit / release process. Any
recommended link?
Op za 2 feb. 2019 14:38 schreef Alec Larson <notifications@github.com:
… Heads up, I force-pushed to remove the merge commit and reword the
createDraft/finishDraft commit so it shows up on the Releases page.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhO5h15iS9Yo9NXlI88RmO49VyG7Vks5vJZTBgaJpZM4afhtr>
.
|
Here you go: https://www.conventionalcommits.org/en/v1.0.0-beta.2/ 👍 |
I wonder if |
Good point, Wii add
Op za 2 feb. 2019 15:00 schreef Alec Larson <notifications@github.com:
… I wonder if createDraft should "tag" its drafts so we can throw if a
produce-made draft is ever passed to finishDraft.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhEAcBbfVZ3Cu5s75sqbhtML8n4Coks5vJZn3gaJpZM4afhtr>
.
|
Also, the types for |
Not for the async version? I would expect to need something like
produce<T>(Draft<T> => Promise<void | T>): Promise<T> ?
Op za 2 feb. 2019 om 15:11 schreef Alec Larson <notifications@github.com>:
… Also, the types for produce require no changes. 🎉
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhAVkzuLQEBISN7UHZOA2qQSsRIVrks5vJZymgaJpZM4afhtr>
.
|
Ah good point, didn't think of the |
No I don't think so, as promises aren't draftable, it doesn't conflict with
any existing use case
Op za 2 feb. 2019 15:15 schreef Alec Larson <notifications@github.com:
… Ah good point, didn't think of the Promise<void> case. Would that make
this a breaking change?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhLoYMZNS_GECfINz6kpUvqiFRa2iks5vJZ2egaJpZM4afhtr>
.
|
While unlikely, some users may have returned a |
dc9c094
to
44ef0c8
Compare
I'm updating the tests to use snapshots for error messages and patches. 😎 |
We may want to consider changing the return type of edit: I went ahead with this. 👍 |
Okay, the return type of |
dfdc465
to
c6cd632
Compare
@aleclarson awesome! I'll proceed with the docs in an iffy, and then we'll should be ready to merge I guess! |
Since we'll be publishing a major, we must decide if #246 should be addressed, too. |
Eh.. why no minor?
Op za 2 feb. 2019 19:02 schreef Alec Larson <notifications@github.com:
… Since we'll be publishing a major, we must decide if #246
<#246> should be addressed,
too.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhCRSvwvqLoVRn1BYthBLyil1XF2oks5vJdLEgaJpZM4afhtr>
.
|
As mentioned here, this PR causes |
But that only changes the static types, not the runtime behavior, correct?
(Imho the best practice is not to count these as breaking changes, cause
otherwise every time the typings improve, you have a breaking change, while
usually it just reveals an already wrong assumption on the consumer)
Op za 2 feb. 2019 19:05 schreef Alec Larson <notifications@github.com:
… As mentioned here
<#307 (comment)>,
this PR causes produce to return Promise<string | T> where it previously
returned Promise<string | undefined>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhAZAi6tSYivue22YdlKV4Wbqqyc1ks5vJdN8gaJpZM4afhtr>
.
|
We never said in the docs that returning a promise from a producer is not supported. We just said not to modify the draft in an "async process", which isn't the same thing.
Nope. Runtime behavior is affected, because we're changing the result of the returned promise. Promises that previously resolved with an undefined value will now resolve with the base state or a modified copy. |
Ok check! I think #246 can be done separately, as that one requires a real
migration
Op za 2 feb. 2019 19:16 schreef Alec Larson <notifications@github.com:
… We never said in the docs that returning a promise from a producer is not
supported. We just said not to modify the draft in an "async process",
which isn't the same thing.
But that only changes the static types, not the runtime behavior, correct?
Nope. Runtime behavior is affected, because we're changing the result of
the returned promise. Promises that previously resolved with an undefined
value will now resolve with the base state or a modified copy.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhBO9FN1l50uDwmYznsZfRXKWBqqSks5vJdX8gaJpZM4afhtr>
.
|
At some point we might remove the this=draft in recipes as well. I think
it's a useless feature
Op za 2 feb. 2019 19:19 schreef Michel Weststrate <mweststrate@gmail.com:
… Ok check! I think #246 can be done separately, as that one requires a real
migration
Op za 2 feb. 2019 19:16 schreef Alec Larson ***@***.***:
> We never said in the docs that returning a promise from a producer is not
> supported. We just said not to modify the draft in an "async process",
> which isn't the same thing.
>
> But that only changes the static types, not the runtime behavior, correct?
>
> Nope. Runtime behavior is affected, because we're changing the result of
> the returned promise. Promises that previously resolved with an undefined
> value will now resolve with the base state or a modified copy.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#307 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABvGhBO9FN1l50uDwmYznsZfRXKWBqqSks5vJdX8gaJpZM4afhtr>
> .
>
|
It's basically useless, but also harmless. Maybe just remove it from the docs? (here) |
Actually, nevermind. We should remove it so you can do the following: const context = {
foo: 1,
bar: produce(function(draft) {
draft.foo = this.foo
})
} |
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
You stole all the credit by squashing it. 😓 |
Darn, thought that was required for semantic-release. If you want I
force-push a normal merge.
Op za 2 feb. 2019 20:55 schreef Alec Larson <notifications@github.com:
… You stole all the credit by squashing it. 😓
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhAV4AdRd7jAxDsMKSGBs2RL7WcV4ks5vJe0dgaJpZM4afhtr>
.
|
Done, an cancelled the resulting build. Hopefully this doesn't mess up the next semantic release computation :-P. |
If it does, I think we just need to manually push the next version to fix it. Thanks! 👍 |
Good point, I'll release a no-op 2.0.1 to make sure it won't be forgotten |
I force pushed a new tag |
Localized branch of #305, implements #302
Remaining work:
createDraft
/finishDraft
apicreate
/finish
Draft