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 timeout when loading image dimensions for image viewer #1268

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

hjiangsu
Copy link
Member

@hjiangsu hjiangsu commented Apr 3, 2024

Pull Request Description

Review without whitespace

This PR adds a two second timeout for retrieving image dimensions on the image viewer. I've noticed that there are often times where some images don't load, or take a long time to load.

This makes it so that the image still loads if retrieving image dimensions fails (given its a proper image). The logic for retrieving image dimensions only affects the maximum zoom level, which is not a critical condition to meet. Thus, if an image fails to load their dimensions, we'll default to a max zoom level of 3.

Issue Being Fixed

Issue Number: N/A

Screenshots / Recordings

Checklist

  • Did you update CHANGELOG.md?
  • Did you use localized strings where applicable?
  • Did you add semanticLabels where applicable for accessibility?

Copy link
Member

@micahmo micahmo left a comment

Choose a reason for hiding this comment

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

Nice! I've noticed this issue too.

I also wonder if there's some way for us to retrieve/calculate the dimensions after the fact and adjust the zoom level then. I've noticed that the dimension loading causes all images to need to wait for two API calls (and there are even two different progress indicators, as referenced in #1082).

@hjiangsu
Copy link
Member Author

hjiangsu commented Apr 3, 2024

I also wonder if there's some way for us to retrieve/calculate the dimensions after the fact and adjust the zoom level then.

I was also thinking about this, and was going to explore it further when we refactor the image viewer (most likely in 0.4.0)! For now, it's just a quick fix for 0.3.0 since I want to release a general build soon

@hjiangsu hjiangsu merged commit 4236b41 into develop Apr 3, 2024
1 check passed
@hjiangsu hjiangsu deleted the fix/image-viewer-loading branch April 3, 2024 14:29
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