dustjs
dustjs copied to clipboard
Passing params down template/partial levels
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
@rragan there is a duplicate ticket for this already.
Veena, Did you mean to comment to me? I wasn't involved in this thread.
@rragan oops!