Skip to content

Commit

Permalink
Move error checking & state update in generatePreviewWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
pkong-ds committed Aug 27, 2024
1 parent 0b09312 commit 5ea9b16
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions public/scripts/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ class RootViewModel {
}

async generatePreviewMockup(imageUpload) {
if (newImage.isErrorState) {
return;
}
window.viewModel.fileList.updateImageUploadStateByULID(
newImage.ulid,
ImageUploadState.GeneratingPreview,
);
runPreviewWorker(await this.getPreviewWorker(), imageUpload);
}

Expand Down Expand Up @@ -785,14 +792,6 @@ function main() {
return;
}
const newImage = viewModel.fileList.imageUploads[newLen - 1];

if (newImage.isErrorState) {
return;
}
window.viewModel.fileList.updateImageUploadStateByULID(
newImage.ulid,
ImageUploadState.GeneratingPreview,
);
viewModel.generatePreviewMockup(newImage);
},
);
Expand Down

0 comments on commit 5ea9b16

Please sign in to comment.