-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Nested partials not working #1218
Comments
Confirmed; c.f. #1185 (comment) |
I am investigating this rn. What I've found thus far is that this line is the source of the infinite recursion: https://github.com/wycats/handlebars.js/blob/master/lib/handlebars/runtime.js#L48. |
Ok, I did a lot of stepping through this code this weekend and root-caused the bug to this line: https://github.com/wycats/handlebars.js/blob/master/lib/handlebars/runtime.js#L218. I'm not sure what should happen, but what does happen is that the I tried to figure out what's going on, but was unable to do so. I think we're going to need @kpdecker's help on this one.
|
@kpdecker 👋 sup |
I have not really been active in Handlebars for a while and just started a new job that is JSX focused rather than Handlebars, so I don't expect to have much time to work on this in the near future. @wycats may be able to tap someone in the Ember community to help out in my absence. |
The root cause of handlebars-lang#1218 is that `invokePartial` creates a stack of data frames for nested partial blocks, but `resolvePartial` always uses the value at top of the stack without "popping" it. The result is an infinite recursive loop, as references to `@partial-block` in the partial at the top of the stack resolve to itself. So, walk up the stack of data frames when evaluating. This is accomplished by 1) setting the `partial-block` property to `noop` after use and 2) using `_parent['partial-block']` if `partial-block` is `noop` Fix handlebars-lang#1218
The root cause of handlebars-lang#1218 is that `invokePartial` creates a stack of data frames for nested partial blocks, but `resolvePartial` always uses the value at top of the stack without "popping" it. The result is an infinite recursive loop, as references to `@partial-block` in the partial at the top of the stack resolve to itself. So, walk up the stack of data frames when evaluating. This is accomplished by 1) setting the `partial-block` property to `noop` after use and 2) using `_parent['partial-block']` if `partial-block` is `noop` Fix handlebars-lang#1218
The root cause of #1218 is that `invokePartial` creates a stack of data frames for nested partial blocks, but `resolvePartial` always uses the value at top of the stack without "popping" it. The result is an infinite recursive loop, as references to `@partial-block` in the partial at the top of the stack resolve to itself. So, walk up the stack of data frames when evaluating. This is accomplished by 1) setting the `partial-block` property to `noop` after use and 2) using `_parent['partial-block']` if `partial-block` is `noop` Fix #1218
The root cause of #1218 is that `invokePartial` creates a stack of data frames for nested partial blocks, but `resolvePartial` always uses the value at top of the stack without "popping" it. The result is an infinite recursive loop, as references to `@partial-block` in the partial at the top of the stack resolve to itself. So, walk up the stack of data frames when evaluating. This is accomplished by 1) setting the `partial-block` property to `noop` after use and 2) using `_parent['partial-block']` if `partial-block` is `noop` Fix #1218
Nested partials cause RangeError.
Example: https://jsfiddle.net/mendlik/bp7jsbd8/3/
This problem is probably a root cause for another issue #1185
The text was updated successfully, but these errors were encountered: