cat-documents-ng 0.3.89 → 0.3.90

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.
@@ -5348,13 +5348,14 @@ class DocumentViewerService {
5348
5348
  * Updates the selected document and recalculates all computed properties
5349
5349
  * @param document The selected document
5350
5350
  */
5351
- updateSelectedDocument(document) {
5351
+ updateSelectedDocument(document, skipLoadDocumentHistory = false) {
5352
5352
  this.documentService.set(document);
5353
5353
  const alertData = this.getAlertData(document);
5354
5354
  const documentStatus = this.calculateDocumentStatus(document);
5355
5355
  const documentIsUploaded = this.calculateIsDocumentUploaded(document);
5356
5356
  this.documentStore.updateDocumentViewerState(document, undefined, undefined, undefined, documentStatus, documentIsUploaded, alertData);
5357
- this.loadDocumentHistory(document._id);
5357
+ if (!skipLoadDocumentHistory && document?._id)
5358
+ this.loadDocumentHistory(document._id);
5358
5359
  }
5359
5360
  /**
5360
5361
  * Loads document history data
@@ -6268,6 +6269,12 @@ class DocumentHistoryComponent {
6268
6269
  if (this.selectedDocument && this.contextId) {
6269
6270
  const documentName = this.selectedDocument?.docName || 'this document';
6270
6271
  ConfirmationDialogComponent.confirmDelete(this.confirmationService, documentName, () => {
6272
+ // Ensure the viewer service has the latest selected document (with _id from history)
6273
+ // eslint-disable-next-line no-console
6274
+ try {
6275
+ this.documentViewerService.updateSelectedDocument?.(this.selectedDocument, true);
6276
+ }
6277
+ catch { }
6271
6278
  const deleteAction = this.documentActionsService.createDeleteAction();
6272
6279
  this.documentViewerService.handleDocumentAction(deleteAction, this.contextId);
6273
6280
  this.deleteTaskRequested.emit();