j-templates 7.0.4 → 7.0.5

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 +13 -1
  2. package/package.json +1 -1
package/Node/vNode.js CHANGED
@@ -113,6 +113,8 @@ function InitNode(vnode) {
113
113
  });
114
114
  vnode.scopes.push(componentScope);
115
115
  Store_1.ObservableScope.Watch(componentScope, CreateScheduledCallback(function () {
116
+ if (vnode.destroyed)
117
+ return;
116
118
  const nodes = Store_1.ObservableScope.Peek(componentScope);
117
119
  vNode.DestroyAll(vnode.children);
118
120
  vnode.children = nodes;
@@ -151,6 +153,8 @@ function StaticChildren(vnode, children) {
151
153
  vnode.scopes.push(childrenScope);
152
154
  Store_1.ObservableScope.Touch(childrenScope);
153
155
  Store_1.ObservableScope.Watch(childrenScope, CreateScheduledCallback(function () {
156
+ if (vnode.destroyed)
157
+ return;
154
158
  vNode.DestroyAll(vnode.children);
155
159
  const nodes = Store_1.ObservableScope.Peek(childrenScope);
156
160
  vnode.children = Array.isArray(nodes) ? nodes : [nodes];
@@ -180,6 +184,8 @@ function DynamicChildren(vnode, children, data) {
180
184
  DestroyNodeList(nodeList);
181
185
  });
182
186
  Store_1.ObservableScope.Watch(childrenScope, CreateScheduledCallback(function () {
187
+ if (vnode.destroyed)
188
+ return;
183
189
  vnode.children = Store_1.ObservableScope.Peek(childrenScope);
184
190
  UpdateChildren(vnode);
185
191
  }));
@@ -287,6 +293,8 @@ function ScheduledAssignment(assign) {
287
293
  return;
288
294
  scheduled = true;
289
295
  nodeConfig_1.NodeConfig.scheduleUpdate(function () {
296
+ if (scope.destroyed)
297
+ return;
290
298
  scheduled = false;
291
299
  const value = Store_1.ObservableScope.Peek(scope);
292
300
  assign(value);
@@ -298,6 +306,10 @@ function CreateScheduledCallback(callback) {
298
306
  return function () {
299
307
  if (scheduled)
300
308
  return;
301
- nodeConfig_1.NodeConfig.scheduleUpdate(callback);
309
+ scheduled = true;
310
+ nodeConfig_1.NodeConfig.scheduleUpdate(function () {
311
+ scheduled = false;
312
+ callback();
313
+ });
302
314
  };
303
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "7.0.4",
3
+ "version": "7.0.5",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",