Skip to content

DOM only updating last element of the loop while diplaying progress #104

@Ashinsk

Description

@Ashinsk

I had an issue while diplaying the progress bar in HTML for a bunch of tasks which was being initiated in a loop. While the CeleryProgressBar was initiated for all the tasks, the progress was only being updated for the last task in the loop.

For a quick fix I had to create a function updateElements everytime before onProgress was called.

      updateElements(){
            this.progressBarElement = document.getElementById(this.progressBarElement.getAttribute('id'))
            this.progressBarMessageElement = document.getElementById(this.progressBarMessageElement.getAttribute('id'))
      }
      onData(data) {
            let done = false;
            if (data.progress) {
                  this.updateElements()
                  this.onProgress(this.progressBarElement, this.progressBarMessageElement, data.progress);
            }
            ........
      }

This solved my issue but would like to know if there is a better solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions