Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mockup preview doesnt work when batch uploading #119

Conversation

pkong-ds
Copy link
Collaborator

Preview

This is a batch job uploading 21 files.

However, there is another problem - the performance. It took ard 7 mins to generate all 21 previews

Preview - Upload

Screen.Recording.2024-08-27.at.7.28.16.PM.mp4

Preview - Preview

Screen.Recording.2024-08-27.at.7.31.18.PM.mp4

Copy link
Contributor

@YayunHuang YayunHuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pkong-ds, I found a small bug when testing, please check check

Comment on lines 726 to 739
// observe fileListViewModel: imageUploads[].length
// side effect: generate preview mockup
mobx.reaction(
() => viewModel.fileList.imageUploads.length,
(newLen) => {
if (viewModel.fileList.imageUploads.length !== newLen) {
console.error("unexpected mobx error, image upload length not matched");
return;
}
const newImage = viewModel.fileList.imageUploads[newLen - 1];
viewModel.generatePreviewMockup(newImage);
},
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will trigger generate preview for last image when removing uploaded images from, that's why I add viewModel.generatePreviewMockup(newImage); in add function, maybe add check if newImage.previewURL != null?

Copy link
Collaborator Author

@pkong-ds pkong-ds Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lemme check it with

if newLen > oldLen

maybe add check if newImage.previewURL != null?

I think this is workaround. This side effect should only be triggered by target observable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks yayun!

@pkong-ds pkong-ds merged commit d73e1d9 into oursky:main Aug 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants