linkedin / linkedin/dustjs

Unexpected behavior of context.getTemplateName()

Open
#755 1 comment 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

Consider a template named `a.html`;

~~~~
Some literals
// inside a helper calling context.getTemplateName() results in 'a.html'
{> "b.html" /}
Some more literals
// inside a helper calling context.getTemplateName() now results in 'b.html'
~~~~

I think invoking context.getTemplateName() should always return the name of the template that is currently rendered, i.e. `a.html` in all cases shown above and `b.html` when invoked inside `b.html'.

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

Start by reproducing the example with a.html, the helper calling context.getTemplateName(), and the included b.html template. Inspect how getTemplateName tracks the current render context; done means it consistently returns a.html from the helper in this case and b.html when called within b.html.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.