@arsedizioni/ars-utils 18.2.513 → 18.2.515

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.
@@ -1388,19 +1388,28 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1388
1388
  return this.clipperService.updateState({ documentIds: documentIds, isRead: value })
1389
1389
  .subscribe(r => {
1390
1390
  if (r.success) {
1391
+ let changed = 0;
1391
1392
  if (item) {
1392
- item.isRead = value;
1393
- this.broadcastService.sendMessage(ClipperMessages.DOCUMENT_READ, { document: item, value: value });
1393
+ if (item.isRead !== value) {
1394
+ item.isRead = value;
1395
+ this.broadcastService.sendMessage(ClipperMessages.DOCUMENT_READ, { document: item, value: value });
1396
+ changed++;
1397
+ }
1394
1398
  }
1395
1399
  else if (this.hasAnySelection()) {
1396
1400
  this.selection?.all?.forEach(n => {
1397
- n.isRead = value;
1398
- this.broadcastService.sendMessage(ClipperMessages.DOCUMENT_READ, { document: n, value: value });
1401
+ if (n.isRead !== value) {
1402
+ n.isRead = value;
1403
+ this.broadcastService.sendMessage(ClipperMessages.DOCUMENT_READ, { document: n, value: value });
1404
+ changed++;
1405
+ }
1399
1406
  });
1400
1407
  }
1401
1408
  // Update dashboard
1402
- this.clipperService.updateUnreadItems(ClipperUtils.getClipperModuleFromModel(item.model), value ? -1 : 1);
1403
- this.changeDetector.markForCheck();
1409
+ if (changed > 0) {
1410
+ this.clipperService.updateUnreadItems(ClipperUtils.getClipperModuleFromModel(item.model), value ? -1 : 1);
1411
+ this.changeDetector.markForCheck();
1412
+ }
1404
1413
  }
1405
1414
  });
1406
1415
  }
@@ -2277,10 +2286,12 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
2277
2286
  this.previewFile(url);
2278
2287
  }
2279
2288
  else {
2280
- // Begin loading only if not downloading a file
2281
- this.busy.set(url.indexOf('documents/render/item') === -1);
2282
- // Navigate
2283
- this.url.set(url);
2289
+ this.clipperService.preRender().subscribe(() => {
2290
+ // Begin loading only if not downloading a file
2291
+ this.busy.set(url.indexOf('documents/render/item') === -1);
2292
+ // Navigate
2293
+ this.url.set(url);
2294
+ });
2284
2295
  }
2285
2296
  }
2286
2297
  /**