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

🐛Expose amp-form response from SSR in submit-success and submit-error events. #25242

Merged
merged 4 commits into from Oct 28, 2019

Conversation

caroqliu
Copy link
Contributor

@caroqliu caroqliu commented Oct 24, 2019

SSR responses get passed fully to the submit-success and submit-error events on amp-form. These often include extra fields such as the HTML to render in the template. This change only exposes to the events the expected values of the amp-form response, such as data inserted into the form fields or relevant errors. b/138778080 cc/ @GoTcWang

Copy link
Contributor

@GoTcWang GoTcWang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, just a comment on that API, but I don't feel strong either way.

extensions/amp-form/0.1/amp-form.js Outdated Show resolved Hide resolved
extensions/amp-form/0.1/amp-form.js Outdated Show resolved Hide resolved
@alanorozco
Copy link
Member

Won't approve since it's not needed from me. LGTM pending @choumx's last comment.

@@ -924,15 +924,18 @@ export class AmpForm {
/**
* Transition the form to the submit success state.
* @param {!JsonObject} result
* @param {!JsonObject} eventData
* @param {?JsonObject=} opt_eventData

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This should be !JsonObject= unless you want to allow passing null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do want to pass null if that is the value for response.body

@caroqliu caroqliu merged commit 48d5ffd into ampproject:master Oct 28, 2019
@caroqliu caroqliu deleted the form-bindings branch October 28, 2019 13:16
caroqliu added a commit that referenced this pull request Nov 6, 2019
nainar pushed a commit that referenced this pull request Nov 6, 2019
erwinmombay pushed a commit that referenced this pull request Nov 6, 2019
caroqliu added a commit that referenced this pull request Nov 11, 2019
* Revert "🐛Expose amp-form response from SSR in `submit-success` and `submit-error` events. (#25242)"

This reverts commit 48d5ffd.

* Add test case for bad json
caroqliu added a commit to caroqliu/amphtml that referenced this pull request Nov 11, 2019
caroqliu added a commit that referenced this pull request Nov 14, 2019
* Intended changes from PR #25242

* Will comments

* Revert removal of `tryResolve()` as it creates friction in unit tests
micajuine-ho pushed a commit to micajuine-ho/amphtml that referenced this pull request Dec 27, 2019
…ror` events. (ampproject#25242)

* Pass response.body

* rename var

* Restructure

* eventData but make it opt
micajuine-ho pushed a commit to micajuine-ho/amphtml that referenced this pull request Dec 27, 2019
micajuine-ho pushed a commit to micajuine-ho/amphtml that referenced this pull request Dec 27, 2019
…5515)

* Revert "🐛Expose amp-form response from SSR in `submit-success` and `submit-error` events. (ampproject#25242)"

This reverts commit 48d5ffd.

* Add test case for bad json
micajuine-ho pushed a commit to micajuine-ho/amphtml that referenced this pull request Dec 27, 2019
…t#25543)

* Intended changes from PR ampproject#25242

* Will comments

* Revert removal of `tryResolve()` as it creates friction in unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants