infinite loop detected, partial 'vfqueryStructure.hbs' was previously loaded

55 views
Skip to first unread message

Pooja Sinha

unread,
Jan 6, 2017, 6:48:42 AM1/6/17
to handlebars.java
"BaseQuery.hbs"

<![CDATA[<?xml version='1.0' encoding='utf-8'?>
<query>
<and>
{{> queryStructure}}
</and>
</query>
]]>

"queryStructure.hbs"

{{#each match}}
{{> match}}
{{/each}}
{{#if greaterThan}}
{{#with greaterThan}}
<greaterThan field="{{field}}" value="{{@value}}" />
{{/with}}
{{/if}}
{{#if text}}
{{#each text}}
{{this}}
{{/each}}
{{/if}}
{{#if not}}
<not>
{{> queryStructure this.not}}
</not>
{{/if}}
{{#if and}}
<and>
{{> queryStructure this.and}}
</and>
{{/if}}

On Running this with JSON:
{
"match": [
{
"field": "source",
"@value": "XXX"
},
{
"@field": "site",
"@value": "$$SITE$$"
},
{
"@field": "organisation",
"@value": "$$ORGANISATION_NODE$$"
},
{
"@field": "status",
"value": [
"Valid",
"ITest"
]
},
{
"@field": "snapshot_id",
"@value": "$$SNAPSHOT_ID$$"
}
],
"not": {
"match": {
"@field": "instrumenttype",
"value": [
"XXXX",
"CYYYYBND"
]
}
},
"text": [
"$$BOOKS_EXCLUDED$$",
"$$BOOKS_INCLUDED$$"
],
"greaterThan": {
"@field": "LastDateToPrice",
"@value": "$$BUSINESS_DATE$$"
}
}


Can anyone please help me out why this is returning me the "infinte loop" warning. I want to invoke the partial again for a sub-part of the JSON (part withn not)

Thanks in advance

Pooja Sinha

unread,
Jan 8, 2017, 11:54:00 PM1/8/17
to handlebars.java
Any help on this please. 

edgar

unread,
Jan 9, 2017, 10:41:53 PM1/9/17
to handlebars.java
Hi,

 You need to enable partial recursion. See here.

Pooja Sinha

unread,
Jan 10, 2017, 2:51:59 AM1/10/17
to handlebars.java
After setting it, I ran into StackOverflow exception. Is there not a way through which we can tell handlebars when to break out of the loop ?
Reply all
Reply to author
Forward
0 new messages