j-templates 8.1.1 → 8.1.2

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.
@@ -35,7 +35,9 @@ export class DiffSync {
35
35
  }
36
36
  SplicePath(path, start, deleteCount, items) {
37
37
  const spliceResult = this.diffTree.SplicePath(path, start, deleteCount, items);
38
- spliceResult.diffResult.push(...this.diffTree.RunProjections());
38
+ const projectionDiff = this.diffTree.RunProjections();
39
+ spliceResult.diffResult = spliceResult.diffResult.concat(projectionDiff);
40
+ // spliceResult.diffResult.push(...this.diffTree.RunProjections());
39
41
  return spliceResult;
40
42
  }
41
43
  }
@@ -214,7 +214,7 @@ function BuildProjectionOrder(projections) {
214
214
  * @returns Diff entries for every projection whose result changed
215
215
  */
216
216
  function RunProjections(source, keyFunc, projections, memo) {
217
- const diffResult = [];
217
+ let diffResult = [];
218
218
  for (let x = 0; x < projections.length; x++) {
219
219
  const { id, reads, projection } = projections[x];
220
220
  const values = [];
@@ -244,10 +244,19 @@ function RunProjections(source, keyFunc, projections, memo) {
244
244
  if (!ArraysEqual(priorValues, values)) {
245
245
  const result = projection(keys, ...values);
246
246
  memo.set(id, values);
247
+ const diff = UpdateSource(source, PROJECTION_PREFIX + id, result, keyFunc);
248
+ diffResult = diffResult.concat(diff);
247
249
  // The same diff-and-apply UpdateSource uses for any other write, so a keyed entity
248
250
  // embedded in a projection's result is flattened to its own root like any other write,
249
251
  // and the diff reported here is unfiltered, the same as DiffPath returns.
250
- diffResult.push(...UpdateSource(source, PROJECTION_PREFIX + id, result, keyFunc));
252
+ /* diffResult.push(
253
+ ...UpdateSource(
254
+ source,
255
+ PROJECTION_PREFIX + id,
256
+ result,
257
+ keyFunc,
258
+ ),
259
+ ); */
251
260
  }
252
261
  }
253
262
  }
@@ -294,12 +303,13 @@ function ResolveKeyPath(source, path, keyFunc) {
294
303
  * @returns Diff results showing all changes made
295
304
  */
296
305
  function UpdateSource(source, path, value, keyFunc) {
297
- const diffResult = [];
306
+ let diffResult = [];
298
307
  if (keyFunc) {
299
308
  const keyPath = ResolveKeyPath(source, path, keyFunc);
300
309
  if (keyPath !== path) {
301
310
  const keyDiffResult = UpdateSource(source, keyPath, value, keyFunc);
302
- diffResult.push(...keyDiffResult);
311
+ diffResult = diffResult.concat(keyDiffResult);
312
+ // diffResult.push(...keyDiffResult);
303
313
  }
304
314
  }
305
315
  const [sourceValue] = GetPathValue(source, path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "8.1.1",
3
+ "version": "8.1.2",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",