This repository was archived by the owner on Apr 4, 2019. It is now read-only.
Commit 26541a0
Encapsulate state needed for re-render
This commit introduces the notion of a “result” data type, which
encapsulates all of the state needed to be passed to a compiled template
in order to successfully re-render with an existing element.
Rather than returning a document fragment, `render()` now returns this
result type. For compatibility, consumers of this API will need to
use the `fragment` property of the result rather than the result
directly.
In order to re-render, you can pass the last result as the `lastResult`
option, and it will use that element and morph to update.
One small additional change: contextual elements must now be passed in
the options hash. We decided to make this change as the list of
arguments was growing unwieldy, and we wanted to make this durable to
changes in the future. We will also investigate incorporating block
params into the options hash.1 parent eb4deaf commit 26541a0
File tree
5 files changed
+75
-71
lines changed- packages
- htmlbars-compiler
- lib
- tests
- htmlbars-runtime/lib
5 files changed
+75
-71
lines changedLines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | | - | |
39 | | - | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
50 | | - | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | | - | |
| 106 | + | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
121 | | - | |
| 124 | + | |
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
| |||
0 commit comments