#Progress bar not updating until refreshing page.

3 messages · Page 1 of 1 (latest)

latent swan
#

I currently have a progress bar that changes when a user deletes a file. The model changes, and the progress bar only changes once I refresh the page. How do I get the progress bar to update without refreshing? Here is the child deleteFile method.

  public async deleteFile(item: any) {
    this.openDialogDeletePrompt().subscribe(async confirmation => {
      if (confirmation === true) {
        if(item.id === 0){
          //Keep all files that are not id 0
          this.target.resultAttachments = [...this.target.resultAttachments ?? []].filter(i => i.id !== item.id);
          //Updated target resultAttachments, but keep all other properities the same
          this.target = {
            ...this.target,
            resultAttachments: this.target.resultAttachments,
        }
      }
      else{
        let deleteFileResponse = await this._monitoringService.deleteFile(item.id)
        if (deleteFileResponse) {
          this.target.resultAttachments = [...this.target.resultAttachments ?? []].filter(i => i.id !== item.id);
          this.target = {
            ...this.target,
            resultAttachments: this.target.resultAttachments,
            status: deleteFileResponse.targetStatus !== undefined ? deleteFileResponse.targetStatus : this.target.status
          };
          this.task.status = deleteFileResponse.taskStatus !== undefined ? deleteFileResponse.taskStatus : this.task.status;
          this.task.taskType = deleteFileResponse.taskType;
          this.targetChange.emit(this.target);
        }
      }
    }
      this.cd.detectChanges();
    })
  }
#

This is the child component ^

latent swan
#

parent html ```html
<progress-stepper [Steps]="statuses" Name="display" [Current]="convertStatusIdToIndex(data.status.id)">
</progress-stepper>