GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): stabilize side-panel click targets across reactive updates by Hona · Pull Request #60436 · anomalyco/opencode

fix(app): stabilize side-panel click targets across reactive updates #60436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Hona merged 1 commit into dev from side-panel-stability
Oct 30, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(app): stabilize side-panel click targets across reactive updates #60436

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
c6c1d2c
fix(app): stabilize side-panel click targets across reactive updates
Hona Oct 30, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

26 changes: 20 additions & 6 deletions 26 packages/app/src/runtime/plugin/panel-menu.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import { createMemo } from "solid-js"
import { MenuItem } from "@opencode/plugin/gui"
import { MenuItem, type SessionPanelMenuItem } from "@opencode/plugin/gui"
import { usePluginHost } from "./host"

/** The side region's + menu: every plugin's `session.panel` item, in order. */
export function createSessionPanelMenu() {
export type SessionPanelMenuEntry = {
readonly key: string
readonly item: SessionPanelMenuItem
}

/** The side region's + menu entries, keyed by `${plugin}:${id}` in display order. */
export function createSessionPanelMenuEntries() {
const host = usePluginHost()

return createMemo(() =>
host
.list(MenuItem)
.flatMap((item) => (item.menu === "session.panel" ? [item] : []))
.toSorted((a, b) => (a.order ?? 0) - (b.order ?? 0)),
.items(MenuItem)
.flatMap((entry): SessionPanelMenuEntry[] =>
entry.value.menu === "session.panel" ? [{ key: `${entry.plugin}:${entry.value.id}`, item: entry.value }] : [],
)
.toSorted((a, b) => (a.item.order ?? 0) - (b.item.order ?? 0)),
)
}

/** The side region's + menu: every plugin's `session.panel` item, in order. */
export function createSessionPanelMenu() {
const entries = createSessionPanelMenuEntries()

return createMemo(() => entries().map((entry) => entry.item))
}
16 changes: 9 additions & 7 deletions 16 packages/app/src/runtime/plugin/panel-trigger.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,18 @@ export function PanelTrigger(props: {
const compactClose = () =>
tooltip(<Tabs.CloseButton onClick={() => props.onClose(props.value)} aria-label={language.t("common.closeTab")} />)

// The close button `closable` asks for; a plain one by default.
const close = () => {
const closable = props.tab.closable
const closable = createMemo(() => props.tab.closable)

if (closable === false) return undefined
// Memoized by `closable` mode so a refreshed RegionEntry never recreates the button mid-click.
const close = createMemo(() => {
const mode = closable()

if (closable === "compact") return compactClose()
if (mode === false) return undefined

return closeButton(closable === "hover")
}
if (mode === "compact") return compactClose()

return closeButton(mode === "hover")
})

return (
<div
Expand Down
45 changes: 29 additions & 16 deletions 45 packages/app/src/runtime/plugin/panels.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,31 @@ export function createRegion(input: {
const stored = () => input.tabs().all()
const providers = createMemo(() => host.items(BuiltinPanel).filter((item) => item.value.region === input.region))

const entries = createMemo(() =>
providers().flatMap((item) => {
const prefix = `${item.plugin}:`
const open = stored().flatMap((key) => (key.startsWith(prefix) ? [key.slice(prefix.length)] : []))

return item.value.list(panelInput(input.view, input.screen, { open })).map(
(tab): RegionEntry => ({
key: panelKey(item.plugin, tab.id),
plugin: item.plugin,
tab,
provider: item.value,
}),
)
}),
const entries = createMemo<RegionEntry[]>(
(previous) => {
const prior = new Map(previous.map((entry) => [entry.key, entry]))

return providers().flatMap((item) => {
const prefix = `${item.plugin}:`
const open = stored().flatMap((key) => (key.startsWith(prefix) ? [key.slice(prefix.length)] : []))

return item.value.list(panelInput(input.view, input.screen, { open })).map((tab): RegionEntry => {
const key = panelKey(item.plugin, tab.id)
const existing = prior.get(key)

if (existing && existing.tab === tab && existing.provider === item.value) return existing

return {
key,
plugin: item.plugin,
tab,
provider: item.value,
}
})
})
},
[],
{ equals: same },
)

const byKey = createMemo(() => new Map(entries().map((entry) => [entry.key, entry])))
Expand Down Expand Up @@ -327,12 +338,14 @@ export function createRegion(input: {
if (state.adding.some((value) => !live(value))) setState("adding", (list) => list.filter(live))
})

const empty = createMemo(() => strip().length === 0)

// Closing the last New tab of a strip with no tabs closes the region, as closing its last tab does.
const dismissNewTab = (id: string) =>
batch(() => {
setState("adding", (list) => list.filter((value) => value.id !== id))

if (stored().length === 0 && !state.adding.some(live)) input.onEmptied?.()
if (empty() && !state.adding.some(live)) input.onEmptied?.()
})

return {
Expand All @@ -342,7 +355,7 @@ export function createRegion(input: {
/** The drawn strip of the pane that holds the selected tab, by key. */
keys: () => panes[activePane()].keys(),
/** The strip holds no tab, hidden ones included. */
empty: createMemo(() => strip().length === 0),
empty,
entry: (key: string) => byKey().get(key),
active,
selected: createMemo(() => {
Expand Down
76 changes: 47 additions & 29 deletions 76 packages/app/src/runtime/plugin/side-region.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ import {
import { useCommand } from "@/shell/commands/command"
import { guardClosingFocus } from "@/shell/panel-motion"
import { useLanguage } from "@/runtime/i18n/language"
import { same } from "@/runtime/persistence/equality"
import { useLayout } from "@/shell/state/layout"
import { useSessionLayout } from "@/session/session-layout"
import type { Sizing } from "@/session/helpers"
import { PanelTrigger } from "./panel-trigger"
import { createSessionPanelMenu } from "./panel-menu"
import { createSessionPanelMenuEntries, type SessionPanelMenuEntry } from "./panel-menu"
import { RegionContent, type Region, type RegionPane } from "./panels"
import { PluginSlot } from "./render"
import { createTabStripScroll } from "./tab-strip-scroll"
Expand Down Expand Up @@ -201,9 +202,9 @@ export function PaneTabs(props: {
}) {
const language = useLanguage()
const { tabs } = useSessionLayout()
const menu = createSessionPanelMenu()
const primary = createMemo(() => menu().find((item) => item.primary))
const launchers = createMemo(() => menu().filter((item) => !item.primary && !item.opened))
const menu = createSessionPanelMenuEntries()
const primary = createMemo(() => menu().find((entry) => entry.item.primary)?.item)
const launchers = createMemo(() => menu().filter((entry) => !entry.item.primary && !entry.item.opened))

// The next tab this pane's "+" menu opens lands in this pane.
const target = () => tabs().target(props.pane.id)
Expand Down Expand Up @@ -331,7 +332,7 @@ export function PaneTabs(props: {
</For>
<div class="h-full shrink-0 sticky end-0 z-10 flex items-center justify-center bg-v2-background-bg-base">
<Show
when={primary() ?? (launchers().length === 0 && menu().length === 1 ? menu()[0] : undefined)}
when={primary() ?? (launchers().length === 0 && menu().length === 1 ? menu()[0]?.item : undefined)}
fallback={
<Show
when={launchers().length > 0}
Expand Down Expand Up @@ -495,9 +496,11 @@ function AddButton(props: { item: SessionPanelMenuItem; onChoose: () => void }):
)
}

function AddMenu(props: { items: readonly SessionPanelMenuItem[]; onChoose: () => void }): JSX.Element {
function AddMenu(props: { items: readonly SessionPanelMenuEntry[]; onChoose: () => void }): JSX.Element {
const language = useLanguage()
const command = useCommand()
const keys = createMemo(() => props.items.map((entry) => entry.key), [], { equals: same })
const byKey = createMemo(() => new Map(props.items.map((entry) => [entry.key, entry.item])))
// A chosen item runs once the closing menu has returned focus to "+", and the tab strip has passed it on to the
// selected tab. Releasing that focus first lets the item move it where its tab needs it, e.g. into a new terminal,
// without the strip taking it back for the tab it remembers.
Expand Down Expand Up @@ -530,27 +533,35 @@ function AddMenu(props: { items: readonly SessionPanelMenuItem[]; onChoose: () =
})
}}
>
<For each={props.items}>
{(item) => {
const keybind = createMemo(() => (item.keybind ? command.keybindParts(item.keybind) : []))

return (
<Menu.Item
class="!gap-6"
onSelect={() => (chosen = item)}
shortcut={
<Show when={keybind().length > 0}>
<Keybind keys={keybind()} variant="neutral" />
</Show>
}
>
<div class="flex items-center gap-2">
<Show when={item.icon}>{(icon) => <Icon name={icon()} size="small" />}</Show>
<span>{item.title}</span>
</div>
</Menu.Item>
)
}}
<For each={keys()}>
{(key) => (
<Show when={byKey().get(key)}>
{(item) => {
const keybind = createMemo(() => {
const bind = item().keybind

return bind ? command.keybindParts(bind) : []
})

return (
<Menu.Item
class="!gap-6"
onSelect={() => (chosen = item())}
shortcut={
<Show when={keybind().length > 0}>
<Keybind keys={keybind()} variant="neutral" />
</Show>
}
>
<div class="flex items-center gap-2">
<Show when={item().icon}>{(icon) => <Icon name={icon()} size="small" />}</Show>
<span>{item().title}</span>
</div>
</Menu.Item>
)
}}
</Show>
)}
</For>
</Menu.Content>
</Menu.Portal>
Expand All @@ -561,14 +572,21 @@ function AddMenu(props: { items: readonly SessionPanelMenuItem[]; onChoose: () =

/** The + menu items as rows, then the session's recently closed tabs, in the new tab view. */
function Launchers(props: {
items: readonly SessionPanelMenuItem[]
items: readonly SessionPanelMenuEntry[]
onChoose: () => void
closed: { entries: readonly ClosedSideTab[]; onReopen: (key: string) => void }
}): JSX.Element {
const keys = createMemo(() => props.items.map((entry) => entry.key), [], { equals: same })
const byKey = createMemo(() => new Map(props.items.map((entry) => [entry.key, entry.item])))

return (
<div class="flex-1 min-h-0 overflow-y-auto px-6">
<div class="mx-auto flex max-w-[560px] flex-col gap-3 pt-12 pb-10">
<For each={props.items}>{(item) => <LauncherRow item={item} onChoose={props.onChoose} />}</For>
<For each={keys()}>
{(key) => (
<Show when={byKey().get(key)}>{(item) => <LauncherRow item={item()} onChoose={props.onChoose} />}</Show>
)}
</For>
<ClosedTabsSection entries={props.closed.entries} onReopen={props.closed.onReopen} />
</div>
</div>
Expand Down
15 changes: 13 additions & 2 deletions 15 packages/gui-plugins/src/browser/connection.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,18 @@ test("a rejected registration clears itself and retries with its tabs after the
app.ipc.reject = new Error("browser.pane.registration.invalid")
await expect(app.connection.command({ type: "reload", tabID })).rejects.toThrow("browser.pane.registration.invalid")
expect(app.listeners.has(app.calls[1].input.binding)).toBe(false)
expect(app.states.at(-1)).toMatchObject({ registration: undefined, embeds: {}, browser, suspended: false })
expect(app.states.at(-1)).toMatchObject({
registration: undefined,
ready: false,
embeds: {},
browser,
suspended: false,
})
// Rejected attempts never mark the attachment ready, and passive wakes do not bypass the active backoff timer.
expect(app.states.slice(2).every((entry) => !entry.ready)).toBe(true)
app.ipc.reject = undefined
app.connection.wake()
expect(app.calls).toHaveLength(2)
jest.advanceTimersByTime(999)
expect(app.calls).toHaveLength(2)
jest.advanceTimersByTime(1)
Expand All @@ -285,9 +295,10 @@ test("a rejected registration clears itself and retries with its tabs after the
session: "ses_browser",
restore: browser,
})
// Let the new registration settle: a replayed command would reach it now.
// Let the new registration settle: a replayed command would reach it now, and resolving marks it ready.
jest.useRealTimers()
await Bun.sleep(0)
expect(app.states.at(-1)?.ready).toBe(true)
expect(app.calls.map((call) => call.commands)).toEqual([[], [], []])
} finally {
app.connection.dispose()
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.