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
Conversation
There was a problem hiding this 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.
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 |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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
* Intended changes from PR #25242 * Will comments * Revert removal of `tryResolve()` as it creates friction in unit tests
…ror` events. (ampproject#25242) * Pass response.body * rename var * Restructure * eventData but make it opt
…ubmit-error` events. (ampproject#25242)" (ampproject#25470) This reverts commit 48d5ffd.
…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
…t#25543) * Intended changes from PR ampproject#25242 * Will comments * Revert removal of `tryResolve()` as it creates friction in unit tests
SSR responses get passed fully to the
submit-success
andsubmit-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