Add image preloading to lightbox navigation#47
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements proactive image preloading in the lightbox component to improve perceived performance when navigating through image galleries. Images ahead of the current position are preloaded in the background using the browser's native Image API.
Key Changes
Added image preloading state management with three new properties:
_preloadedUrls: Set to track which images have been preloaded (prevents duplicate requests)_preloadedImages: Array holding Image object references to keep them in memory_preloadAheadCount: Configurable number of images to preload ahead (defaults to 5)Implemented
_preloadUpcoming()method that:_preloadAheadCountIntegrated preloading into navigation flow by calling
_preloadUpcoming()at key points:Implementation Details
Imageobjects withdecoding='async'for non-blocking preloadingisImage()content type checkhttps://claude.ai/code/session_01Q5kMwNZQipPztAShGoyLw1