@hmcts/ccd-case-ui-toolkit 7.3.54-exui-4309 → 7.3.54-exui-3229

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.
@@ -8876,9 +8876,14 @@ class CaseEditWizardGuard {
8876
8876
  }
8877
8877
  goToFirst(wizard, canShowPredicate, route) {
8878
8878
  const firstPage = wizard.firstPage(canShowPredicate);
8879
- // If there’s no specific wizard page called, it makes another navigation to either the first page available or to the submit page
8880
- // TODO should find a way to navigate to target page without going through the whole loop (and make a second call to BE) again
8881
- return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], { queryParams: route.queryParams });
8879
+ // This route transition is an internal wizard redirect used to append the first page id to the URL.
8880
+ // Mark it in navigation state so EventStartGuard can skip duplicate work allocation checks.
8881
+ return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], {
8882
+ queryParams: route.queryParams,
8883
+ state: {
8884
+ [EVENT_START_FIRST_PAGE_REDIRECT]: true
8885
+ }
8886
+ });
8882
8887
  }
8883
8888
  goToSubmit(route) {
8884
8889
  return this.router.navigate([...this.parentUrlSegments(route), 'submit'], { queryParams: route.queryParams });
@@ -10101,6 +10106,7 @@ class CaseEditComponent {
10101
10106
  }] }); })();
10102
10107
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 39 }); })();
10103
10108
 
10109
+ const EVENT_START_FIRST_PAGE_REDIRECT = 'eventStartFirstPageRedirect';
10104
10110
  function convertNonASCIICharacter(character) {
10105
10111
  if (character === '£') {
10106
10112
  // pound sign will be frequently used and works for btoa despite being non-ASCII
@@ -11398,7 +11404,6 @@ class CaseEditPageComponent {
11398
11404
  }
11399
11405
  ngOnInit() {
11400
11406
  initDialog();
11401
- this.clearValidationErrors();
11402
11407
  this.eventTrigger = this.caseEdit.eventTrigger;
11403
11408
  this.editForm = this.caseEdit.form;
11404
11409
  this.wizard = this.caseEdit.wizard;
@@ -11454,7 +11459,6 @@ class CaseEditPageComponent {
11454
11459
  this.dialogRefAfterClosedSub?.unsubscribe();
11455
11460
  this.saveDraftSub?.unsubscribe();
11456
11461
  this.caseFormValidationErrorsSub?.unsubscribe();
11457
- this.clearValidationErrors();
11458
11462
  this.multipageComponentStateService.reset();
11459
11463
  }
11460
11464
  applyValuesChanged(valuesChanged) {
@@ -11478,7 +11482,7 @@ class CaseEditPageComponent {
11478
11482
  * EUI-3732 - Breathing space data not persisted on Previous button click with ExpUI Demo
11479
11483
  */
11480
11484
  toPreviousPage() {
11481
- this.clearValidationErrors();
11485
+ this.caseEditDataService.clearFormValidationErrors();
11482
11486
  const caseEventData = this.buildCaseEventData(true);
11483
11487
  caseEventData.data = caseEventData.event_data;
11484
11488
  this.updateFormData(caseEventData);
@@ -11651,7 +11655,7 @@ class CaseEditPageComponent {
11651
11655
  this.editForm.controls['data'].removeControl('caseLinksFlag');
11652
11656
  }
11653
11657
  }
11654
- this.clearValidationErrors();
11658
+ this.caseEditDataService.clearFormValidationErrors();
11655
11659
  this.checkForStagesCompleted();
11656
11660
  if (this.currentPageIsNotValid()) {
11657
11661
  // The generateErrorMessage method filters out the hidden fields.
@@ -11815,7 +11819,7 @@ class CaseEditPageComponent {
11815
11819
  else {
11816
11820
  this.caseEdit.cancelled.emit();
11817
11821
  }
11818
- this.clearValidationErrors();
11822
+ this.caseEditDataService.clearFormValidationErrors();
11819
11823
  this.multipageComponentStateService.reset();
11820
11824
  }
11821
11825
  resetLinkedCaseJourney() {
@@ -11883,7 +11887,6 @@ class CaseEditPageComponent {
11883
11887
  console.log('handleError ', error);
11884
11888
  }
11885
11889
  resetErrors() {
11886
- this.clearValidationErrors();
11887
11890
  this.caseEdit.error = null;
11888
11891
  this.caseEdit.ignoreWarning = false;
11889
11892
  this.triggerText = this.getTriggerText();
@@ -11891,10 +11894,6 @@ class CaseEditPageComponent {
11891
11894
  this.caseEdit.callbackErrorsSubject.next(null);
11892
11895
  }
11893
11896
  }
11894
- clearValidationErrors() {
11895
- this.validationErrors = [];
11896
- this.caseEditDataService?.clearFormValidationErrors?.();
11897
- }
11898
11897
  saveDraft() {
11899
11898
  if (this.eventTrigger.can_save_draft) {
11900
11899
  const draftCaseEventData = this.formValueService.sanitise(this.editForm.value);
@@ -37879,6 +37878,10 @@ class EventStartGuard {
37879
37878
  }
37880
37879
  }
37881
37880
  return caseDataObservable.pipe(switchMap(() => {
37881
+ if (this.shouldSkipDuplicateWorkAllocationCall()) {
37882
+ this.abstractConfig.logMessage(`EventStartGuard: skipping duplicate work allocation call for caseId ${caseId} and eventId ${eventId}`);
37883
+ return of(true);
37884
+ }
37882
37885
  if (this.jurisdiction && this.caseType) {
37883
37886
  if (this.caseId === caseId) {
37884
37887
  return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, this.caseType, this.jurisdiction)
@@ -37892,6 +37895,9 @@ class EventStartGuard {
37892
37895
  return of(false);
37893
37896
  }));
37894
37897
  }
37898
+ shouldSkipDuplicateWorkAllocationCall() {
37899
+ return this.router.getCurrentNavigation()?.extras?.state?.[EVENT_START_FIRST_PAGE_REDIRECT] === true;
37900
+ }
37895
37901
  checkTaskInEventNotRequired(payload, caseId, taskId, eventId, userId) {
37896
37902
  if (!payload || !payload.tasks) {
37897
37903
  return true;