From 7a418ee62bd61d812de772909e28dff8cf79cdf9 Mon Sep 17 00:00:00 2001 From: Admin Date: Sat, 4 Apr 2026 21:15:06 +0500 Subject: [PATCH] fix: await marked() to prevent Promise being passed as chapter HTML marked() returns string | Promise; the previous cast 'as string' silently passed a Promise object, which Svelte rendered as nothing. Free users saw blank content even though SSR HTML was correct. --- ui/src/routes/books/[slug]/chapters/[n]/+page.server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/routes/books/[slug]/chapters/[n]/+page.server.ts b/ui/src/routes/books/[slug]/chapters/[n]/+page.server.ts index 2a45c2e..0088f7f 100644 --- a/ui/src/routes/books/[slug]/chapters/[n]/+page.server.ts +++ b/ui/src/routes/books/[slug]/chapters/[n]/+page.server.ts @@ -154,7 +154,7 @@ export const load: PageServerLoad = async ({ params, url, locals }) => { error(res.status === 404 ? 404 : 502, res.status === 404 ? `Chapter ${n} not found` : 'Could not fetch chapter content'); } const markdown = await res.text(); - html = marked(markdown) as string; + html = await marked(markdown); } catch (e) { if (e instanceof Error && 'status' in e) throw e; // Don't hard-fail — show empty content with error message