j-templates 7.0.37 → 7.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Node/vNode.js +9 -4
- package/package.json +1 -1
package/Node/vNode.js
CHANGED
|
@@ -154,9 +154,15 @@ function CreateChildrenScope(vnode, children, data) {
|
|
|
154
154
|
if (data === undefined)
|
|
155
155
|
return Store_1.ObservableScope.Create(WrapStaticChildren(vnode, children));
|
|
156
156
|
const dataIsAsync = (0, functions_1.IsAsync)(data);
|
|
157
|
+
if (dataIsAsync) {
|
|
158
|
+
const dataScope = Store_1.ObservableScope.Create(data);
|
|
159
|
+
vnode.scopes.push(dataScope);
|
|
160
|
+
data = function () {
|
|
161
|
+
return Store_1.ObservableScope.Value(dataScope);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
157
164
|
const nodeList = list_1.List.Create();
|
|
158
|
-
const scope = Store_1.ObservableScope.Create(WrapChildren(vnode.injector, children, ToArray(data),
|
|
159
|
-
scope.async = dataIsAsync;
|
|
165
|
+
const scope = Store_1.ObservableScope.Create(WrapChildren(vnode.injector, children, ToArray(data), nodeList));
|
|
160
166
|
Store_1.ObservableScope.OnDestroyed(scope, function () {
|
|
161
167
|
DestroyNodeList(nodeList);
|
|
162
168
|
});
|
|
@@ -169,7 +175,7 @@ function WrapStaticChildren(vnode, children) {
|
|
|
169
175
|
return CreateNodeArray(childNodes, vnode.children);
|
|
170
176
|
};
|
|
171
177
|
}
|
|
172
|
-
function WrapChildren(injector, children, data,
|
|
178
|
+
function WrapChildren(injector, children, data, nodeList) {
|
|
173
179
|
return function () {
|
|
174
180
|
const nextData = data();
|
|
175
181
|
switch (nextData.length) {
|
|
@@ -197,7 +203,6 @@ function WrapChildren(injector, children, data, dataIsAsync, nodeList) {
|
|
|
197
203
|
const childNodes = injector_1.Injector.Scope(injector, children, data);
|
|
198
204
|
return CreateNodeArray(childNodes);
|
|
199
205
|
});
|
|
200
|
-
childrenScope.async = dataIsAsync;
|
|
201
206
|
list_1.List.Add(nextNodeList, {
|
|
202
207
|
data,
|
|
203
208
|
nodes: Store_1.ObservableScope.Value(childrenScope),
|