[Lightbox] Always rely on Expo Image cache #6189
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removes our own caching layer for image dimensions. Instead, rely on
onLoad
callback fromexpo-image
which tells us the dimensions. So if the image is cached byexpo-image
, these will come through viaonLoad
.In the lightbox, until
onLoad
fires for the full image, we'll use either the embed record dimensions (if available), or fall back to the already fetched thumbnail dimensions (determined byonLoad
in the feed).What this gives us:
onLoad
in feed ran in time — since we know the aspect ratio early in that caseTest Plan
Verify that images animate when opening. Notably, images on posts like https://bsky.app/profile/docdre.bsky.social/post/3l6lzzqhxwh2o (which has no image dimensions in embed record) will also animate now.
Comment out the
onLoad
calls inAutoSizedImage.tsx
andGallery.tsx
. Verify they aren't essential — the lightbox works without them. For posts with no dimensions in the embed (https://bsky.app/profile/docdre.bsky.social/post/3l6lzzqhxwh2o), the lightbox would not animate without thoseonLoad
calls — similar as before this PR. It should still display though. Posts with dimensions in embed records should continue animating even without thoseonLoad
calls.Verify images appear cropped in feed similarly as before. Verify the animation from the cropped ones works.
Not sure how to verify this, but I'd expect that we no longer fire duplicate requests for images with missing dimensions.