linkedin / linkedin/dustjs

partial parameters are lower on the stack than context

Open
#313 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.9k
Forks
461
PR merge metrics
No merged PRs in 30d

Description

When giving a partial parameters, they are pushed down the stack and the previous context is pushed onto head. If there are two variables with the same name, then the partial parameter will be hidden by the higher context.

This is confusing default behaviour and seems inconsistent to how sections operate.

I'm aware of the changes introduced by #132 - but this seems like a hack to fix the issue of not searching a higher context ( #271 ).

See example below. Expect x=2, but it is x=1.

``` javascript
dust.loadSource(dust.compile("partial says x={x}", "part"));
dust.loadSource(dust.compile("{>part x=\"2\" /}", "test"));
var data = {
x :1
};

dust.render("test", data, function(err, out) {
$("body").html(out);
});
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The supplied JavaScript reproduction uses dust.loadSource, dust.compile, and dust.render; start there and trace how partial parameters and contexts are resolved. Done means the example renders x=2 while section lookup behavior remains consistent, with coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.