Issue #495 fixed partial parameter context isolation by ensuring that when parameters are passed to a partial, the parent context doesn't leak through. This has regressed in recent versions.
For example:
{{~#*inline "displayName"~}}
Template:{{name}}
{{/inline}}
{{#each data as |name|}}
Name:{{name}}
{{>displayName name="aaaa"}}
{{/each}}
with data:
{
"data": ["hudel", "test"]
}
should output:
Name:hudel
Template:aaaa
Name:test
Template:aaaa
but currently outputs:
Name:hudel
Template:hudel
Name:test
Template:test
The parent context's name is leaking into the partial despite explicitly passing name="aaaa".
The regression appears to be related to changes in block context handling in partial.rs.
The current unit test for this issue (test_partial_context_issue_495) is incorrect - it tests context inheritance rather than context isolation.
Original fix: #495
Current incorrect test:
|
fn test_partial_context_issue_495() { |
Issue #495 fixed partial parameter context isolation by ensuring that when parameters are passed to a partial, the parent context doesn't leak through. This has regressed in recent versions.
For example:
with data:
{ "data": ["hudel", "test"] }should output:
but currently outputs:
The parent context's
nameis leaking into the partial despite explicitly passingname="aaaa".The regression appears to be related to changes in block context handling in
partial.rs.The current unit test for this issue (
test_partial_context_issue_495) is incorrect - it tests context inheritance rather than context isolation.Original fix: #495
Current incorrect test:
handlebars-rust/src/partial.rs
Line 506 in 8066a73