@absolutejs/sync 2.1.0 → 2.2.1

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/dist/index.js CHANGED
@@ -1563,6 +1563,9 @@ var createSyncEngine = (options = {}) => {
1563
1563
  return subscription.view.reset(await subscription.rehydrate());
1564
1564
  }
1565
1565
  }
1566
+ if (subscription.affects && !subscription.affects(change)) {
1567
+ return EMPTY_DIFF;
1568
+ }
1566
1569
  return subscription.view.reset(await subscription.rehydrate());
1567
1570
  };
1568
1571
  const subscriptionsForTable = function* (table) {
@@ -2355,6 +2358,7 @@ var createSyncEngine = (options = {}) => {
2355
2358
  return readRule ? rows.filter((row) => readRule(ctx, row)) : rows;
2356
2359
  };
2357
2360
  const incremental = match !== undefined && tables.length === 1;
2361
+ const boundAffects = !incremental && definition.affects ? (change) => definition.affects(change, params, ctx) : undefined;
2358
2362
  const boundMatch = incremental ? (row) => match(row, params, ctx) && (readRule ? readRule(ctx, row) : true) : () => true;
2359
2363
  const view = createMaterializedView({
2360
2364
  key,
@@ -2369,6 +2373,7 @@ var createSyncEngine = (options = {}) => {
2369
2373
  view,
2370
2374
  incremental,
2371
2375
  rehydrate,
2376
+ ...boundAffects ? { affects: boundAffects } : {},
2372
2377
  key,
2373
2378
  onDiff: typedOnDiff
2374
2379
  };
@@ -3505,5 +3510,5 @@ export {
3505
3510
  createPresenceHub
3506
3511
  };
3507
3512
 
3508
- //# debugId=B94BDA3C56450BBB64756E2164756E21
3513
+ //# debugId=A1FB7830183D82D164756E2164756E21
3509
3514
  //# sourceMappingURL=index.js.map