Skip to content

Conversation

mikermcneil
Copy link
Member

This is not a perfect solution. But for certain bits of generic logic, it might make sense:

await ƒ.createZohoRecord.undo('CustomModule99', {});

On the other hand, the biggest issue is that in many cases, the reversibility of an instruction really ends up being very specific to its use as an instruction, rather than something exclusive to its machine definition. For example:

var newStripeCustomerId = await ƒ.stripe.saveBillingInfo.with({
  emailAddress: 'mike@example.com'
});
await ƒ.stripe.saveBillingInfo.undo.with({
  emailAddress: 'mike@example.com'
});
^^ could _technically_ work, because we know this was a "create"

// But...
await ƒ.stripe.saveBillingInfo.with({
  emailAddress: 'mike@example.com',
  stripeCustomerId: 'cust_ba3f8a3'
});
await ƒ.stripe.saveBillingInfo.undo.with({
  emailAddress: 'mike@example.com',
  stripeCustomerId: 'cust_ba3f8a3'
});
^^ but THIS would have to throw an error, because it's impossible to know what the email was before we updated it to be "mike@example.com"


// In other words, we probably shouldn't define a `handleUndo` function for the `saveBillingInfo` machine.  We could, of course, but it would be a "sometimes" thing, which kinda sucks because it's confusing and inconsistent.

In practice, I think there's probably a better way to go about this in the form of some kind of affordance in userland... (That way at least argins and intermediate operations before the undo can be taken into account!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant