Eventlistener when all files have finished

whats the eventlistener for for when all files in the current queue/batch have finished

common-upload-success - will only fire if there no failures
common-upload-failed - fires immediately after the first failure

what waits to the end of success and failures as more of a queue complete event?

Hi @Michael_Smith, there is currently no dedicated event type for this. Could you please elaborate on your use case and the requirements behind your question?

using the blocks file uploader inline, our uses could be dragging and dropping files in batches, maybe 5 and then 10 for upload etc, i was hoping to do something with an event after a batch of files have finished uploading, like updating some html content on the page. i dont specifically need the details of the uploaded or failed files just that the particular batch has finished. which could include all success, all failures or a mixture.

i was also trying to check in each file-upload-success if anything else was still in progress state which would mean it was the last file if there wasnt, however i couldnt figure it out
i tried testing
getOutputCollectionState
but i got a function not found

any ideas how to achieve this would be great

Thanks for the clarification! As a workaround, you can try using the change event in this way:

const ctx = document.querySelector("lr-upload-ctx-provider");
ctx.addEventListener("change", (e) => {
  const state = e.detail;
  const isAllFinished =
    state.totalCount === state.successCount + state.failedCount;
  if (isAllFinished) {
    console.log("Batch finished");
  }
});

perfect! thanks alex

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.