From 57d73381b28cbb27d3934acfc77eaf1ab6c6f6d0 Mon Sep 17 00:00:00 2001 From: MadDogOwner Date: Fri, 26 Jun 2026 19:14:49 +0800 Subject: [PATCH 1/2] fix(File): add ErrorBoundary to Previews Signed-off-by: MadDogOwner --- src/pages/home/file/File.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pages/home/file/File.tsx b/src/pages/home/file/File.tsx index b5f2e40f0..83f578086 100644 --- a/src/pages/home/file/File.tsx +++ b/src/pages/home/file/File.tsx @@ -1,7 +1,7 @@ import { HStack, VStack } from "@hope-ui/solid" -import { createMemo, Show, Suspense } from "solid-js" +import { createMemo, ErrorBoundary, Show, Suspense } from "solid-js" import { Dynamic } from "solid-js/web" -import { FullLoading, SelectWrapper } from "~/components" +import { Error, FullLoading, SelectWrapper } from "~/components" import { objStore } from "~/store" import { useRouter } from "~/hooks" import { Download } from "../previews/download" @@ -38,9 +38,11 @@ const File = () => { /> - }> - - + }> + }> + + + ) From 93d22dd4a6568acf503a88a698c99bca12d7ea09 Mon Sep 17 00:00:00 2001 From: MadDogOwner Date: Fri, 26 Jun 2026 19:17:50 +0800 Subject: [PATCH 2/2] fix(url): throw Error directly Signed-off-by: MadDogOwner --- src/pages/home/previews/url.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pages/home/previews/url.tsx b/src/pages/home/previews/url.tsx index 79dec018b..6c85378c2 100644 --- a/src/pages/home/previews/url.tsx +++ b/src/pages/home/previews/url.tsx @@ -9,18 +9,18 @@ import { createMemo } from "solid-js" export default function () { const [content] = useFetchText() const { copy } = useUtil() + const t = useT() const url = createMemo(() => { - try { - const ini = content()?.content || "" - const { text } = useParseText(ini) - const config = recordKeysToLowerCase(parse(text() || "")) - return config.internetshortcut?.url || "#" - } catch (error) { - console.error("Error parsing INI content:", error) - return "#" - } + if (content.loading) return "" + const ini = content()?.content + if (!ini) throw new Error("No content") + if (typeof ini === "string") throw new Error(ini) + const { text } = useParseText(ini) + const config = recordKeysToLowerCase(parse(text() || "")) + const shortcutUrl = config.internetshortcut?.url + if (!shortcutUrl) throw new Error("Invalid .url file: no URL found") + return shortcutUrl }) - const t = useT() return (