dustjs icon indicating copy to clipboard operation
dustjs copied to clipboard

Passing params down template/partial levels

Open richard-ive opened this issue 12 years ago • 3 comments

I have an issue where a partial causes a body function to call it's self recursively causing Chrome and Firefox to throw a 'RangeError: Maximum call stack size exceeded'.

This is the hierarchy of partials I have:

parent template:

{>"start_to_end_date" label="Dates:"        name="propertydates" id="propertydates" value="" type="text" size="input-small" data="data-required='required'"/}

start_to_end_date

{>"input_text" id="{id}x"/}

note: {id} is from first template

input_text

<input type="text" id="{id}" name="{name}" {data} class="{size} include {classes}" value="{value}" />

note: {id} is from start_to_end_date

I have debugged the code and found that at the point where {id} is passed from start_to_end_date into input_text it is already a body_4 function which has obviously been complied. So when {id} is read inside input_text the context key id is a function in the tail.head of body_4. So, as the context is not reset it continues passing the id of body_4, and therefore keeps calling its self until the browser throws a warning.

Sorry if I've note explained this very well, i'll try again if needs be. It could be that I'm using partial parameters in the wrong way, but I wanted to check first.

Thanks. Rich

richard-ive avatar Nov 21 '12 15:11 richard-ive

@rragan there is a duplicate ticket for this already.

vybs avatar Nov 21 '12 16:11 vybs

Veena, Did you mean to comment to me? I wasn't involved in this thread.

rragan avatar Nov 21 '12 17:11 rragan

@rragan oops!

vybs avatar Nov 21 '12 17:11 vybs