Skip to content

Commit 1d958c8

Browse files
authored
fix: don't wait for image to load (#10)
1 parent d132b33 commit 1d958c8

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/lib/server/nina.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ export class NinaClient {
255255
}
256256
return this.cachedLiveImage;
257257
}
258+
259+
haveImage() {
260+
return !!this.cachedLiveImage;
261+
}
258262
}
259263

260264
export const nina = new NinaClient();

src/routes/[[lang=lang]]/live-photo/+page.server.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import type { PageServerLoad } from './$types';
44
export const load = (async ({ parent, url }) => {
55
const data = await parent();
66

7-
const img = await nina.getLiveImage();
8-
97
return {
108
meta: {
119
title: data.lang.live_photo.title,
1210
description: data.lang.live_photo.description,
13-
image: img ? `${url.origin}/api/live-image` : undefined
11+
image: nina.haveImage() ? `${url.origin}/api/live-image` : undefined
1412
}
1513
};
1614
}) satisfies PageServerLoad;

0 commit comments

Comments
 (0)