-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
amp-bind: Support intermediary vars in AMP.setState() #8397
Comments
Could setState take a variable number of object literals and then call bind's setState on them in order? |
Also, couldn't this be used to get around our expression complexity limit? |
Yes, though it's a slightly more complex change since we'd have to change the action parser.
Expressions in |
I'm thinking though that if we allow multi-step calculations, then someone could just break up a larger calculation into multiple steps to circumvent the complexity limit. For instance if my expression is A + B where A and B are complex expressions and (A + B) has an AST size of 51 (one over the current limit) then I could do.
or
|
Good point, we'd have to have a more sophisticated constraint to avoid that. |
We could put a limit on the number of sequential setStates, but even then each one we allow multiplies our effective complexity limit. |
Another option is to add a new custom element:
Slightly less powerful and more explicit than chaining |
Once #8678 is in, won't users be able to chain |
Fixed with #12285. |
Benefits
Possible solution
One approach is to allow chained actions. E.g. instead of...
...do this:
This doesn't work today because the second action doesn't wait for the first to complete.
Only really painful in more complicated use cases though, e.g.
examples/bind/turing.amp.html
.The text was updated successfully, but these errors were encountered: