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

Closed
honzatrtik opened this Issue Feb 6, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@honzatrtik

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

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Feb 6, 2014

Contributor

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).

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

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Feb 7, 2014

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.

Contributor

justinbmeyer commented Feb 7, 2014

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

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Feb 7, 2014

Contributor

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

Contributor

daffl commented Feb 7, 2014

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

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Apr 7, 2014

Contributor

Fixed via #874

Contributor

daffl commented Apr 7, 2014

Fixed via #874

@daffl daffl closed this Apr 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment