-
Notifications
You must be signed in to change notification settings - Fork 56
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
ForCompiler bug #88
Comments
I think that this change produced another bug with nested loop. For example, this code compiles well
But this one desn't:
I think that it is because when the loop variable is used in parent for it sets its attribute "with_loop" to true and adds loop variable in JS. When parent do not use the loop variable then parent's "with_loop" is not set so variable loop is not set, but it is used in child for. |
This change wasn't merged |
Sorry, my bad, both lines look very similar. Either way, bug exists, and is coused by reference to nonexisting loop variable (which does not exits if parent doesn't use loop in its body). |
We can use the following code inside twig templates:
{{ loop.parent.loop.index0 }}
It works great on our server, where twig compiles into php files, but it doesn't work when we try to compile it in JavaScript.
You can fix it very easy, just replace this line with the following:
and merge other things to the parent context.
The text was updated successfully, but these errors were encountered: