Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the live-photo page load performance by eliminating an async image fetch operation that could cause significant delays (up to 5 seconds on timeout). Instead of calling getLiveImage() during server-side rendering, the code now uses a new synchronous haveImage() method to check if a cached image exists.
Changes:
- Added new
haveImage()method to NinaClient that synchronously checks cache status - Modified live-photo page server load function to use
haveImage()instead of asyncgetLiveImage() - Eliminated blocking network call during page load, improving Time To First Byte (TTFB)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/lib/server/nina.ts | Added synchronous haveImage() method that checks if cachedLiveImage exists without triggering a network fetch |
| src/routes/[[lang=lang]]/live-photo/+page.server.ts | Replaced async getLiveImage() call with synchronous haveImage() check to prevent blocking during SSR |
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.
Currently the live-image page was waiting for the response of get-image, meaning, that person clicked the page, and he must wait like 5 second to for example timeout... This change, only check condition, and directly open page.