linkedin / linkedin/dustjs

braindump: rerenderables

Open
#747 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

@jimmyhchan talked about this last year and I think it finally clicked for me.

`dust.render` returns undefined right now and uses a callback. Jimmy talked about "streaming into templates" last year and I never quite grokked it, but I think this might be it.

What about an API something like this:

```
let renderable = dust.render(template, context, function(err, out) {
// some side effect, appending to or replacing DOM or whatever
});

renderable.render(anotherContext); // uses the same template and the same callback
someStream.pipe(renderable); // maybe this invokes the callback once for every data event
```

This would give you a `renderable` that you could store and reuse to update a certain portion of DOM with new data. Identifying when data changed would still be your responsibility, this is just so you don't have to manually wire it all up again.

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 reading the existing dust.render API and its callback behavior. Clarify the reusable renderable and stream semantics before implementation, including how repeated renders invoke the callback. Done should include an agreed API and tests covering the proposed usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.