From 29d6784c59f6e1a54b5e9ad9700275dad8d4463e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 20 Oct 2025 12:46:24 +0300 Subject: [PATCH] feat(client/print): render 404 errors --- apps/client/src/print.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/client/src/print.tsx b/apps/client/src/print.tsx index 697ab1a6b..4aff8729b 100644 --- a/apps/client/src/print.tsx +++ b/apps/client/src/print.tsx @@ -18,18 +18,19 @@ async function main() { const froca = (await import("./services/froca")).default; const note = await froca.getNote(noteId); - if (!note) return; - render(, document.body); + render(, document.body); } -function App({ note }: { note: FNote }) { +function App({ note, noteId }: { note: FNote | null | undefined, noteId: string }) { const sentReadyEvent = useRef(false); const onReady = useCallback(() => { if (sentReadyEvent.current) return; window.dispatchEvent(new Event("note-ready")); sentReadyEvent.current = true; }, []); - const props: RendererProps = { note, onReady }; + const props: RendererProps | undefined | null = note && { note, onReady }; + + if (!note || !props) return return ( <> @@ -74,4 +75,13 @@ function CollectionRenderer({ note, onReady }: RendererProps) { />; } +function Error404({ noteId }: { noteId: string }) { + return ( +
+

The note you are trying to print could not be found.

+ {noteId} +
+ ) +} + main();