mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-30 20:44:31 +00:00
fix: remove route dependency from server dialog
This commit is contained in:
parent
421f3bbd0b
commit
482ef946fe
4 changed files with 9 additions and 7 deletions
|
|
@ -8,7 +8,6 @@ import { List } from "@opencode-ai/ui/list"
|
|||
import { TextField } from "@opencode-ai/ui/text-field"
|
||||
import { useMutation } from "@tanstack/solid-query"
|
||||
import { showToast } from "@opencode-ai/ui/toast"
|
||||
import { useNavigate } from "@solidjs/router"
|
||||
import { createEffect, createMemo, createResource, onCleanup, Show } from "solid-js"
|
||||
import { createStore, reconcile } from "solid-js/store"
|
||||
import { DialogLocalServer } from "@/components/dialog-local-server"
|
||||
|
|
@ -23,6 +22,7 @@ const DEFAULT_USERNAME = "opencode"
|
|||
interface DialogSelectServerProps {
|
||||
initialView?: "list" | "local"
|
||||
initialTargetMode?: "windows" | "wsl"
|
||||
onNavigateHome?: () => void
|
||||
}
|
||||
|
||||
interface ServerFormProps {
|
||||
|
|
@ -178,7 +178,6 @@ function ServerForm(props: ServerFormProps) {
|
|||
}
|
||||
|
||||
export function DialogSelectServer(props: DialogSelectServerProps = {}) {
|
||||
const navigate = useNavigate()
|
||||
const dialog = useDialog()
|
||||
const server = useServer()
|
||||
const platform = usePlatform()
|
||||
|
|
@ -364,10 +363,10 @@ export function DialogSelectServer(props: DialogSelectServerProps = {}) {
|
|||
dialog.close()
|
||||
if (persist && conn.type === "http") {
|
||||
server.add(conn)
|
||||
navigate("/")
|
||||
props.onNavigateHome?.()
|
||||
return
|
||||
}
|
||||
navigate("/")
|
||||
props.onNavigateHome?.()
|
||||
queueMicrotask(() => server.setActive(ServerConnection.key(conn)))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -329,7 +329,10 @@ export function StatusPopoverBody(props: { shown: Accessor<boolean> }) {
|
|||
const run = ++dialogRun
|
||||
void import("./dialog-select-server").then((x) => {
|
||||
if (dialogDead || dialogRun !== run) return
|
||||
dialog.show(() => <x.DialogSelectServer />, defaultServer.refresh)
|
||||
dialog.show(
|
||||
() => <x.DialogSelectServer onNavigateHome={() => navigate("/")} />,
|
||||
defaultServer.refresh,
|
||||
)
|
||||
})
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export default function Home() {
|
|||
size="large"
|
||||
variant="ghost"
|
||||
class="mt-4 mx-auto text-14-regular text-text-weak"
|
||||
onClick={() => dialog.show(() => <DialogSelectServer />)}
|
||||
onClick={() => dialog.show(() => <DialogSelectServer onNavigateHome={() => navigate("/")} />)}
|
||||
>
|
||||
<div
|
||||
classList={{
|
||||
|
|
|
|||
|
|
@ -1209,7 +1209,7 @@ export default function Layout(props: ParentProps) {
|
|||
const run = ++dialogRun
|
||||
void import("@/components/dialog-select-server").then((x) => {
|
||||
if (dialogDead || dialogRun !== run) return
|
||||
dialog.show(() => <x.DialogSelectServer />)
|
||||
dialog.show(() => <x.DialogSelectServer onNavigateHome={() => navigate("/")} />)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue