fix: type error

This commit is contained in:
adamelmore
2026-01-24 17:01:37 -06:00
parent 3fdd6ec120
commit e223d1a0e5

View File

@@ -1,6 +1,5 @@
import { import {
For, For,
Index,
onCleanup, onCleanup,
onMount, onMount,
Show, Show,
@@ -41,7 +40,6 @@ import { useLayout } from "@/context/layout"
import { Terminal } from "@/components/terminal" import { Terminal } from "@/components/terminal"
import { checksum, base64Encode, base64Decode } from "@opencode-ai/util/encode" import { checksum, base64Encode, base64Decode } from "@opencode-ai/util/encode"
import { findLast } from "@opencode-ai/util/array" import { findLast } from "@opencode-ai/util/array"
import { getFilename } from "@opencode-ai/util/path"
import { useDialog } from "@opencode-ai/ui/context/dialog" import { useDialog } from "@opencode-ai/ui/context/dialog"
import { DialogSelectFile } from "@/components/dialog-select-file" import { DialogSelectFile } from "@/components/dialog-select-file"
import { DialogSelectModel } from "@/components/dialog-select-model" import { DialogSelectModel } from "@/components/dialog-select-model"
@@ -67,7 +65,6 @@ import {
SortableTerminalTab, SortableTerminalTab,
NewSessionView, NewSessionView,
} from "@/components/session" } from "@/components/session"
import { usePlatform } from "@/context/platform"
import { navMark, navParams } from "@/utils/perf" import { navMark, navParams } from "@/utils/perf"
import { same } from "@/utils/same" import { same } from "@/utils/same"
@@ -103,7 +100,7 @@ function SessionReviewTab(props: SessionReviewTabProps) {
const sdk = useSDK() const sdk = useSDK()
const readFile = (path: string) => { const readFile = async (path: string) => {
return sdk.client.file return sdk.client.file
.read({ path }) .read({ path })
.then((x) => x.data) .then((x) => x.data)
@@ -192,7 +189,6 @@ export default function Page() {
const codeComponent = useCodeComponent() const codeComponent = useCodeComponent()
const command = useCommand() const command = useCommand()
const language = useLanguage() const language = useLanguage()
const platform = usePlatform()
const params = useParams() const params = useParams()
const navigate = useNavigate() const navigate = useNavigate()
const sdk = useSDK() const sdk = useSDK()
@@ -745,7 +741,7 @@ export default function Page() {
const sessionID = params.id const sessionID = params.id
if (!sessionID) return if (!sessionID) return
if (status()?.type !== "idle") { if (status()?.type !== "idle") {
await sdk.client.session.abort({ sessionID }).catch(() => {}) await sdk.client.session.abort({ sessionID }).catch(() => { })
} }
const revert = info()?.revert?.messageID const revert = info()?.revert?.messageID
// Find the last user message that's not already reverted // Find the last user message that's not already reverted
@@ -828,69 +824,69 @@ export default function Page() {
}, },
...(sync.data.config.share !== "disabled" ...(sync.data.config.share !== "disabled"
? [ ? [
{ {
id: "session.share", id: "session.share",
title: "Share session", title: "Share session",
description: "Share this session and copy the URL to clipboard", description: "Share this session and copy the URL to clipboard",
category: "Session", category: "Session",
slash: "share", slash: "share",
disabled: !params.id || !!info()?.share?.url, disabled: !params.id || !!info()?.share?.url,
onSelect: async () => { onSelect: async () => {
if (!params.id) return if (!params.id) return
await sdk.client.session await sdk.client.session
.share({ sessionID: params.id }) .share({ sessionID: params.id })
.then((res) => { .then((res) => {
navigator.clipboard.writeText(res.data!.share!.url).catch(() => navigator.clipboard.writeText(res.data!.share!.url).catch(() =>
showToast({
title: "Failed to copy URL to clipboard",
variant: "error",
}),
)
})
.then(() =>
showToast({ showToast({
title: "Session shared", title: "Failed to copy URL to clipboard",
description: "Share URL copied to clipboard!",
variant: "success",
}),
)
.catch(() =>
showToast({
title: "Failed to share session",
description: "An error occurred while sharing the session",
variant: "error", variant: "error",
}), }),
) )
}, })
.then(() =>
showToast({
title: "Session shared",
description: "Share URL copied to clipboard!",
variant: "success",
}),
)
.catch(() =>
showToast({
title: "Failed to share session",
description: "An error occurred while sharing the session",
variant: "error",
}),
)
}, },
{ },
id: "session.unshare", {
title: "Unshare session", id: "session.unshare",
description: "Stop sharing this session", title: "Unshare session",
category: "Session", description: "Stop sharing this session",
slash: "unshare", category: "Session",
disabled: !params.id || !info()?.share?.url, slash: "unshare",
onSelect: async () => { disabled: !params.id || !info()?.share?.url,
if (!params.id) return onSelect: async () => {
await sdk.client.session if (!params.id) return
.unshare({ sessionID: params.id }) await sdk.client.session
.then(() => .unshare({ sessionID: params.id })
showToast({ .then(() =>
title: "Session unshared", showToast({
description: "Session unshared successfully!", title: "Session unshared",
variant: "success", description: "Session unshared successfully!",
}), variant: "success",
) }),
.catch(() => )
showToast({ .catch(() =>
title: "Failed to unshare session", showToast({
description: "An error occurred while unsharing the session", title: "Failed to unshare session",
variant: "error", description: "An error occurred while unsharing the session",
}), variant: "error",
) }),
}, )
}, },
] },
]
: []), : []),
]) ])
@@ -2475,13 +2471,11 @@ export default function Page() {
}} }}
> >
<Show when={pty.id} keyed> <Show when={pty.id} keyed>
{() => ( <Terminal
<Terminal pty={pty}
pty={pty} onCleanup={terminal.update}
onCleanup={terminal.update} onConnectError={() => terminal.clone(pty.id)}
onConnectError={() => terminal.clone(pty.id)} />
/>
)}
</Show> </Show>
</div> </div>
)} )}