Skip to content
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

.updateWith() should only be callable if event was canceled #589

Closed
marcoscaceres opened this issue Aug 22, 2017 · 1 comment
Closed

.updateWith() should only be callable if event was canceled #589

marcoscaceres opened this issue Aug 22, 2017 · 1 comment

Comments

@marcoscaceres
Copy link
Member

The way the spec is currently written, the payment sheet of a browser can lock up waiting on ev.updateWith() to be called.

What actually needs to happen is:

  1. That the developer needs to cancel the event somehow and then call ev.updateWith() - maybe .updateWith() cancels the event automatically? (I like this, because it means existing apps can continue to work without devs needing to make any changes to their existing code! And browsers need only make a small change.)
  2. the browser needs to check if the event was cancelled. If yes, wait for .updateWith(). If no, reuse the existing data (or present whatever data the user has changed - like a new address or shipping option). Payment sheets already do this when changing credit cards, email, phone number, for instance (where no event is fired at the page).

So, Proposal:

  • Calling updateWith() sets the event's cancel flag.
  • In the sheet:
    • If the event was not cancelled, then just update reusing the existing data + whatever new data the user provide/changed.
  • Otherwise, wait for .updateWith()'s promise to settle.

Pre-empting discussion: checking if an event listener/handler is set on the payment request would violate the DOM spec (because it would be a side-effect). That would be very bad.

@marcoscaceres marcoscaceres changed the title .updateWith() should only be callable if event was cancelled .updateWith() should only be callable if event was canceled Aug 22, 2017
@marcoscaceres
Copy link
Member Author

Might not need to deal with cancel flag at all, because we have [[waitForUpdate]].

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

No branches or pull requests

1 participant