Skip to content
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

Recursive mustache template ends with "Maximum call stack size exceeded" #723

Closed
honzatrtik opened this issue Feb 6, 2014 · 4 comments
Closed
Labels
Milestone

Comments

@honzatrtik
Copy link

i'm trying to render recursive tree structure with canjs mustache engine, but getting "Maximum call stack size exceeded" - code reproducing this behaviour: http://jsfiddle.net/R5Vbw/3/

@daffl
Copy link
Contributor

daffl commented Feb 6, 2014

Here is an updated example that works: http://jsfiddle.net/R5Vbw/2/

The reason is that if Mustache doesn't find it on the current object it walk up to the parent and tries to look it up there.

This is however an issue that we are hoping to solve in 2.1 (probably by prefixing with ./ if you want to prevent the scope lookup).

@justinbmeyer
Copy link
Contributor

Another explanation for myself:

This fails because #children is always going to be found, so {{> #template}} will be recursed indefinitely.

There is not much we can do to prevent this.

@daffl do we have an issue for ./ if we do, we should reference and close this issue.

@daffl
Copy link
Contributor

daffl commented Feb 7, 2014

I couldn't find one that's why I left this one open.

@daffl
Copy link
Contributor

daffl commented Apr 7, 2014

Fixed via #874

@daffl daffl closed this as completed Apr 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants