j-templates 7.0.37 → 7.0.38

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.
Files changed (2) hide show
  1. package/Node/vNode.js +9 -3
  2. package/package.json +1 -1
package/Node/vNode.js CHANGED
@@ -154,8 +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), dataIsAsync, nodeList));
165
+ const scope = Store_1.ObservableScope.Create(WrapChildren(vnode.injector, children, ToArray(data), nodeList));
159
166
  scope.async = dataIsAsync;
160
167
  Store_1.ObservableScope.OnDestroyed(scope, function () {
161
168
  DestroyNodeList(nodeList);
@@ -169,7 +176,7 @@ function WrapStaticChildren(vnode, children) {
169
176
  return CreateNodeArray(childNodes, vnode.children);
170
177
  };
171
178
  }
172
- function WrapChildren(injector, children, data, dataIsAsync, nodeList) {
179
+ function WrapChildren(injector, children, data, nodeList) {
173
180
  return function () {
174
181
  const nextData = data();
175
182
  switch (nextData.length) {
@@ -197,7 +204,6 @@ function WrapChildren(injector, children, data, dataIsAsync, nodeList) {
197
204
  const childNodes = injector_1.Injector.Scope(injector, children, data);
198
205
  return CreateNodeArray(childNodes);
199
206
  });
200
- childrenScope.async = dataIsAsync;
201
207
  list_1.List.Add(nextNodeList, {
202
208
  data,
203
209
  nodes: Store_1.ObservableScope.Value(childrenScope),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "7.0.37",
3
+ "version": "7.0.38",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",