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

Add loading indicator for the image compression #483

Merged
merged 6 commits into from
Mar 8, 2024

Conversation

mingming-ma
Copy link
Collaborator

@mingming-ma mingming-ma commented Feb 23, 2024

Explanation

I set the imageUrl to empty string firstly inside the process image functions and then update it with real url result when compression is done. If it is empty, the spinner in a square box will be rendered as loading status.

Result

Desktop Mobile
image image

Fixes: #467

Copy link

cloudflare-workers-and-pages bot commented Feb 23, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2597843
Status: ✅  Deploy successful!
Preview URL: https://0c1dc76b.console-overthinker-dev.pages.dev
Branch Preview URL: https://mingming-loadingindicator-46.console-overthinker-dev.pages.dev

View logs

@mingming-ma mingming-ma self-assigned this Feb 23, 2024
@mingming-ma mingming-ma added this to the Release 1.4 milestone Feb 23, 2024
@mingming-ma mingming-ma marked this pull request as ready for review February 23, 2024 19:01
@WangGithub0 WangGithub0 self-requested a review March 6, 2024 15:51
Copy link
Collaborator

@Rachit1313 Rachit1313 left a comment

Choose a reason for hiding this comment

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

looks good to me.

.then((base64Strings) => {
setInputImageUrls((prevImageUrls) => [...prevImageUrls, ...base64Strings]);
})
.catch((err) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you still need add the catch err in your processImages function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, the processImages function has catch for handling errors, do you mean we can remove it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Keep it please. We don't want to fail and crash, or fail silently.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, the processImages function has catch for handling errors, do you mean we can remove it?

sorry, github folded that part, I thought you miss it.
It looks good to me!

@mingming-ma mingming-ma merged commit 599110f into main Mar 8, 2024
4 checks passed
@mingming-ma mingming-ma deleted the mingming/loadingindicator#467 branch April 10, 2024 16:32
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.

Add loading indicator for the image compression
4 participants