nested calls to Chunk.map never return
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 461
- PR merge metrics
- No merged PRs in 30d
Description
It seems that map does not work when called on an already mapped chunk.
For example, this code will never execute the dust.render callback:
``` javascript
dust.loadSource(dust.compile("test of async mapping {x}", "test"));
var data = {
x : function(chunk) {
return chunk.map(function(chunk2) {
var f2 = function() {
chunk2.write("hmmm!");
// change the next line to chunk.map and it works as expected
chunk2.map(function(chunk3) {
var f3 = function() {
chunk3.write("mmm!!");
chunk3.end();
};
setTimeout(f3, 1000);
});
chunk2.end();
};
setTimeout(f2, 1000);
});
}
};
dust.render("test", data, function(err, out) {
$("body").html(out);
});
```
Is this a limitation, a bug, or am I doing something horrible?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Chunk.map implementation and any existing tests for nested or asynchronous mapping. Reproduce the supplied example, trace the nested callback and completion behavior, and consider the issue done when nested Chunk.map calls complete and the dust.render callback receives the rendered output.
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
- 30/100