Skip to content

Commit 1a9dc2e

Browse files
committed
Revert "feat(desktop): enhance Windows app resolution and UI loading states (anomalyco#13084)"
This reverts commit cf7a1b8.
1 parent 224d770 commit 1a9dc2e

File tree

2 files changed

+87
-350
lines changed

2 files changed

+87
-350
lines changed

packages/app/src/components/session/session-header.tsx

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createEffect, createMemo, createResource, onCleanup, Show } from "solid-js"
1+
import { createEffect, createMemo, onCleanup, Show } from "solid-js"
22
import { createStore } from "solid-js/store"
33
import { Portal } from "solid-js/web"
44
import { useParams } from "@solidjs/router"
@@ -18,7 +18,6 @@ import { IconButton } from "@opencode-ai/ui/icon-button"
1818
import { Button } from "@opencode-ai/ui/button"
1919
import { AppIcon } from "@opencode-ai/ui/app-icon"
2020
import { DropdownMenu } from "@opencode-ai/ui/dropdown-menu"
21-
import { Spinner } from "@opencode-ai/ui/spinner"
2221
import { Tooltip, TooltipKeybind } from "@opencode-ai/ui/tooltip"
2322
import { Popover } from "@opencode-ai/ui/popover"
2423
import { TextField } from "@opencode-ai/ui/text-field"
@@ -168,7 +167,6 @@ export function SessionHeader() {
168167

169168
const [prefs, setPrefs] = persisted(Persist.global("open.app"), createStore({ app: "finder" as OpenApp }))
170169
const [menu, setMenu] = createStore({ open: false })
171-
const [openRequest, setOpenRequest] = createStore({ app: undefined as OpenApp | undefined, version: 0 })
172170

173171
const canOpen = createMemo(() => platform.platform === "desktop" && !!platform.openPath && server.isLocal())
174172
const current = createMemo(() => options().find((o) => o.id === prefs.app) ?? options()[0])
@@ -181,32 +179,20 @@ export function SessionHeader() {
181179
setPrefs("app", options()[0]?.id ?? "finder")
182180
})
183181

184-
const [openTask] = createResource(
185-
() => openRequest.app && openRequest.version,
186-
async () => {
187-
const app = openRequest.app
188-
const directory = projectDirectory()
189-
if (!app || !directory || !canOpen()) return
190-
191-
const item = options().find((o) => o.id === app)
192-
const openWith = item && "openWith" in item ? item.openWith : undefined
193-
await platform.openPath?.(directory, openWith)
194-
},
195-
)
196-
197-
createEffect(() => {
198-
const err = openTask.error
199-
if (!err) return
200-
showToast({
201-
variant: "error",
202-
title: language.t("common.requestFailed"),
203-
description: err instanceof Error ? err.message : String(err),
204-
})
205-
})
206-
207182
const openDir = (app: OpenApp) => {
208-
if (openTask.loading) return
209-
setOpenRequest({ app, version: openRequest.version + 1 })
183+
const directory = projectDirectory()
184+
if (!directory) return
185+
if (!canOpen()) return
186+
187+
const item = options().find((o) => o.id === app)
188+
const openWith = item && "openWith" in item ? item.openWith : undefined
189+
Promise.resolve(platform.openPath?.(directory, openWith)).catch((err: unknown) => {
190+
showToast({
191+
variant: "error",
192+
title: language.t("common.requestFailed"),
193+
description: err instanceof Error ? err.message : String(err),
194+
})
195+
})
210196
}
211197

212198
const copyPath = () => {
@@ -362,18 +348,12 @@ export function SessionHeader() {
362348
<div class="flex h-[24px] box-border items-center rounded-md border border-border-base bg-surface-panel overflow-hidden">
363349
<Button
364350
variant="ghost"
365-
class="rounded-none h-full py-0 pr-3 pl-2 gap-1.5 border-none shadow-none disabled:!cursor-default"
366-
classList={{
367-
"bg-surface-raised-base-active": openTask.loading,
368-
}}
351+
class="rounded-none h-full py-0 pr-3 pl-2 gap-1.5 border-none shadow-none"
369352
onClick={() => openDir(current().id)}
370-
disabled={openTask.loading}
371353
aria-label={language.t("session.header.open.ariaLabel", { app: current().label })}
372354
>
373355
<div class="flex size-5 shrink-0 items-center justify-center">
374-
<Show when={openTask.loading} fallback={<AppIcon id={current().icon} class="size-4" />}>
375-
<Spinner class="size-3.5 text-icon-base" />
376-
</Show>
356+
<AppIcon id={current().icon} class="size-4" />
377357
</div>
378358
<span class="text-12-regular text-text-strong">Open</span>
379359
</Button>
@@ -388,11 +368,7 @@ export function SessionHeader() {
388368
as={IconButton}
389369
icon="chevron-down"
390370
variant="ghost"
391-
disabled={openTask.loading}
392-
class="rounded-none h-full w-[24px] p-0 border-none shadow-none data-[expanded]:bg-surface-raised-base-active disabled:!cursor-default"
393-
classList={{
394-
"bg-surface-raised-base-active": openTask.loading,
395-
}}
371+
class="rounded-none h-full w-[24px] p-0 border-none shadow-none data-[expanded]:bg-surface-raised-base-active"
396372
aria-label={language.t("session.header.open.menu")}
397373
/>
398374
<DropdownMenu.Portal>
@@ -409,7 +385,6 @@ export function SessionHeader() {
409385
{options().map((o) => (
410386
<DropdownMenu.RadioItem
411387
value={o.id}
412-
disabled={openTask.loading}
413388
onSelect={() => {
414389
setMenu("open", false)
415390
openDir(o.id)

0 commit comments

Comments
 (0)