@hmcts/ccd-case-ui-toolkit 7.3.42 → 7.3.43-4371-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.
@@ -9837,6 +9837,11 @@ class CaseEditComponent {
9837
9837
  const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9838
9838
  const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9839
9839
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9840
+ if (this.caseDetails && (this.caseDetails.case_id !== task?.case_id)) {
9841
+ this.abstractConfig.logMessage(`postCompleteTaskIfRequired: task in session storage with taskId ${task?.id} has caseId: ${task?.case_id} which does not match case details case id ${this.caseDetails.case_id}, NOT completing task and clearing client context`);
9842
+ this.sessionStorageService.removeItem(CaseEditComponent.CLIENT_CONTEXT);
9843
+ return of(true);
9844
+ }
9840
9845
  if (task && assignNeeded && taskToBeCompleted) {
9841
9846
  this.abstractConfig.logMessage(`postCompleteTaskIfRequired with assignNeeded: taskId ${task.id} and event name ${this.eventTrigger?.name}`);
9842
9847
  return this.workAllocationService.assignAndCompleteTask(task.id, this.eventTrigger.name);