From 72f73b6deddf2ffde6a9081226909d610869d3a0 Mon Sep 17 00:00:00 2001 From: shuv Date: Tue, 30 Dec 2025 13:13:44 -0800 Subject: [PATCH 1/4] fix(app): always call list for parent directory in file fetch --- packages/app/src/context/local.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/app/src/context/local.tsx b/packages/app/src/context/local.tsx index 23d706bb010..cb9098ac3f0 100644 --- a/packages/app/src/context/local.tsx +++ b/packages/app/src/context/local.tsx @@ -364,9 +364,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({ const fetch = async (path: string) => { const relativePath = relative(path) const parent = relativePath.split("/").slice(0, -1).join("/") - if (parent) { - await list(parent) - } + await list(parent) } const init = async (path: string) => { From 41645b1ab9007f227b85322b8739fc2c2fe88bd3 Mon Sep 17 00:00:00 2001 From: shuv Date: Tue, 30 Dec 2025 13:13:49 -0800 Subject: [PATCH 2/4] feat(app): add image preview support in file tabs with SVG code toggle --- packages/app/src/pages/session.tsx | 98 ++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 25 deletions(-) diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx index 6b9ff9e0811..31be5fd5281 100644 --- a/packages/app/src/pages/session.tsx +++ b/packages/app/src/pages/session.tsx @@ -8,6 +8,7 @@ import { createResource, createMemo, createEffect, + createSignal, on, createRenderEffect, batch, @@ -20,6 +21,7 @@ import { PromptInput } from "@/components/prompt-input" import { DateTime } from "luxon" import { FileIcon } from "@opencode-ai/ui/file-icon" import { IconButton } from "@opencode-ai/ui/icon-button" +import { Button } from "@opencode-ai/ui/button" import { Icon } from "@opencode-ai/ui/icon" import { Tooltip } from "@opencode-ai/ui/tooltip" import { DiffChanges } from "@opencode-ai/ui/diff-changes" @@ -579,6 +581,71 @@ export default function Page() { ) } + const FileTabContent = (props: { path: string; codeComponent: typeof codeComponent }): JSX.Element => { + const [file] = createResource( + () => props.path, + async (path) => local.file.node(path), + ) + const content = createMemo(() => file()?.content) + const isImage = createMemo( + () => content()?.encoding === "base64" && content()?.mimeType?.startsWith("image/"), + ) + const isSvg = createMemo(() => content()?.mimeType === "image/svg+xml") + const [showCode, setShowCode] = createSignal(false) + const decodedContent = createMemo(() => { + const c = content() + if (c?.encoding === "base64" && c.content) { + return atob(c.content) + } + return c?.content ?? "" + }) + return ( + + + {(f) => ( +
+ +
+ +
+
+
+ {f().path} +
+
+ )} +
+ +
+ +
+ +
+
+ +
+
+
+ ) + } + const SortableTab = (props: { tab: string onTabClick: (tab: string) => void @@ -874,33 +941,14 @@ export default function Page() { {(tab) => { - const [file] = createResource( - () => tab, - async (tab) => { - if (tab.startsWith("file://")) { - return local.file.node(tab.replace("file://", "")) - } - return undefined - }, - ) + const path = tab.startsWith("file://") ? tab.replace("file://", "") : undefined + // Trigger the file load + if (path) local.file.init(path) return ( - - - {(f) => ( - - )} - - + + + ) }} From df05231dcb76de46ca8b74786dc2146b729cf753 Mon Sep 17 00:00:00 2001 From: shuv Date: Tue, 30 Dec 2025 13:56:08 -0800 Subject: [PATCH 3/4] fix(app): handle empty path in file list to avoid leading slash --- packages/app/src/context/local.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/app/src/context/local.tsx b/packages/app/src/context/local.tsx index cb9098ac3f0..4eb139dbdce 100644 --- a/packages/app/src/context/local.tsx +++ b/packages/app/src/context/local.tsx @@ -395,8 +395,9 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({ } const list = async (path: string) => { + const listPath = path ? path + "/" : "" return sdk.client.file - .list({ path: path + "/" }) + .list({ path: listPath }) .then((x) => { setStore( "node", From 35681dc1181f032e0330cc4390f20d0bd2a4fd63 Mon Sep 17 00:00:00 2001 From: shuv Date: Tue, 30 Dec 2025 13:56:13 -0800 Subject: [PATCH 4/4] fix(app): remove redundant file init call during tab render --- packages/app/src/pages/session.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx index 31be5fd5281..27d2c77eafe 100644 --- a/packages/app/src/pages/session.tsx +++ b/packages/app/src/pages/session.tsx @@ -942,8 +942,6 @@ export default function Page() { {(tab) => { const path = tab.startsWith("file://") ? tab.replace("file://", "") : undefined - // Trigger the file load - if (path) local.file.init(path) return (