Skip to content

Conversation

@patrick11514
Copy link
Owner

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 async getLiveImage()
  • 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

@patrick11514 patrick11514 merged commit 1d958c8 into main Jan 29, 2026
9 checks passed
@patrick11514 patrick11514 deleted the fix/add-load-for-live branch January 29, 2026 07:54
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.

1 participant