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
Add "fetch-error" event for amp-list/amp-state #21512
Add "fetch-error" event for amp-list/amp-state #21512
Conversation
this.requestSignIn_(); | ||
if (method === 'updateActionState') { | ||
// "updateActionState" requires a low-trust event. | ||
if (invocation.satisfiesTrust(ActionTrust.LOW) && args) { |
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.
@hellokoji Are we sure we want to allow arbitrary arguments to updateActionState
? It's more error prone due to typos for example.
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.
Currently, updateActionState
takes an object parameter with an actionStatus
string field and a result
object field. We could make a white-list on the actionStatus
string to error out quicker given an invalid argument, but for the result
field, the schema can get pretty complex.
Right now we support COMPLETED_ACTION_STATUS
, ACTIVE_ACTION_STATUS
, and FAILED_ACTION_STATUS
. I am okay with white-listing just those three.
/to @cathyxz /cc @aghassemi |
@@ -461,10 +458,13 @@ export class AmpList extends AMP.BaseElement { | |||
} | |||
|
|||
return fetch.catch(error => { | |||
const actions = Services.actionServiceForDoc(this.element); | |||
actions.trigger(this.element, 'fetch-error', null, ActionTrust.LOW); |
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.
okay that this may fire multiple times in case of infinite scroll?
- If not, it can just be moved below
if (opt_append)
- If yes, we may wanna have an event object with more info (e.g. which load run it failed)
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.
Yea, I think it makes more sense that way.
If yes, we may wanna have an event object with more info
Perhaps, let's wait for that FR. :)
Thanks for the reviews! |
I think you'll need to rebase for
|
Fixes #21322.
Also updates amp-viewer-assistance action handlers to such that
signIn
is high-trust andupdateActionState
is low-trust.