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(gui-plugins): drive the artifact viewer, image pan, video overlay and select preview through state machines by Hona · Pull Request #61993 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Nov 5, 2026

Copy link
Copy Markdown
Member

Moves four implicit lifecycles onto explicit state machines and fixes the bugs each one hid: the <Select> highlight preview (packages/ui) and the file artifact viewer's mode/decode state, image pan gesture and video overlay (packages/gui-plugins).

Bugs fixed

Area Sequence Before After
Select Hover B (preview returns an undo), click B onChange ran onSelect(B) and then B's undo, reverting the committed value Choosing the previewed option keeps it; any other preview reverts before onSelect
Select Item focus/pointermove during the close animation, or a parent sets open={false} A new preview applied after close and stayed until unmount; controlled close skipped the undo Highlights while closed or committed are ignored; a controlled close reverts
Artifact Open a malformed text diagram.svg Decode failure flipped the kind to binary, removing View source Placeholder shows, View source stays, the raw markup opens
Artifact A plugin viewer or <img> reports after the file is reread Late onError/onDetails were stamped onto the new content Results carry the content they decoded; stale ones are ignored
Image pan Drag, release outside capture, hover Plain hover kept panning under grabbing A mouse move with the primary button up ends the pan
Image pan Ctrl+wheel to fit (or Fit) mid-drag dragging stuck at zoom ≤ 1 Zoom back to fit ends the pan and releases capture
Image pan Drag ends in pointercancel Sticky dragged swallowed the next click Cancel never suppresses; suppression lasts until that click or the next press
Image pan Drag 200 px past a clamp wall, reverse Origin-based offset stayed stuck on the wall Each move pans by its own delta and clamps
Video Expand, then Escape Fullscreen button flashed over the empty stage while the video flew back Controls stay hidden until the video is back in the stage
Video Tab closes while the preview is open Orphaned preview dialog The stage closes its preview by id
Video Move pointer while paused, click Play 2.3 s later Stale idle timer hid controls 200 ms after Play Play starts a fresh timer; paused moves start none

State machines

// packages/ui/src/forms/select/machine.ts
type SelectHighlightState =
  | { status: "closed" } | { status: "idle" } | { status: "previewing"; key: string }
  | { status: "committed" } | { status: "disposed" }

// packages/gui-plugins/src/file/artifact-view-machine.ts
type ArtifactViewerState =
  | { status: "preview" | "source"; content: FileContent; info: ArtifactInfo }
  | { status: "undecodable"; content: FileContent; mode: ArtifactMode; reason?: string }

type ImageStageGestureState =
  | { status: "idle" } | { status: "panning"; pointerId: number; moved: boolean }
  | { status: "suppress-click" } | { status: "disposed" }

type VideoOverlayState =
  | { status: "loading"; paused: boolean; issued: number }
  | { status: "paused" | "playing-active" | "playing-idle"; issued: number }
  | { status: "expanded"; issued: number; paused: boolean }
  | { status: "disposed" }
stateDiagram-v2
  direction LR
  state "Select" as S {
    closed --> idle: open
    idle --> previewing: highlight / apply
    previewing --> previewing: other key / revert, apply
    previewing --> committed: select same key
    previewing --> committed: select other / revert
    previewing --> closed: close / revert
    committed --> closed: close
  }
Loading
stateDiagram-v2
  direction LR
  state "Image pan" as P {
    idle --> panning: primary down, zoomed / capture
    panning --> panning: first move past 3px
    panning --> suppress_click: up after move
    panning --> idle: up, cancel, buttons up, zoom to fit / release
    suppress_click --> idle: click (swallowed) or next press
  }
  state "Video overlay" as V {
    loading --> paused: loadeddata
    paused --> playing_active: play / schedule(n)
    playing_active --> playing_idle: idle(n) or leave
    playing_idle --> playing_active: move / schedule(n+1)
    paused --> expanded: expand / open(n)
    playing_active --> expanded: expand / open(n)
    expanded --> paused: returned(n)
    expanded --> playing_idle: returned(n)
  }
Loading
  • issued numbers each idle timer and preview; idle.elapsed and preview.returned with another number are ignored.
  • The video counts as returned when a MutationObserver on its frame sees it back in the stage, when onClose runs before the preview borrowed it, or when the preview's dialog root is disposed (bounded by the dialog's exit), so expanded always ends.
  • Pan offsets are plain driver numbers painted straight to img.style.transform; only the press, the threshold-crossing move and the release dispatch, so steady pan moves write no signal and allocate no event.
  • ArtifactView, ImageStage and VideoStage hold the machines in signals; no machine state lives in a store.

Deleted

  • HighlightState and the mutable stop/move in select.tsx.
  • ViewerState, saved/change/fail merges, view.x/view.y/view.dragging, let drag, let dragged, and the loadedUrl/paused/active/open signals plus wake/clearIdle in artifact-view.tsx.

Product calls and deviations from the design

  • View source follows Copy: offered for text files of a previewable kind, including after a decode failure; never for binary content (its source view would be base64).
  • Video controls stay hidden while loading (before, the fullscreen button showed but did nothing until the first frame).
  • <ImageStage>/<VideoStage> remount per media URL as before; a reread that streams from the same URL keeps the mounted media.
  • Dropped the design's click.expired timer: suppress-click clears on the next press instead, which also covers touch pans with no click and avoids a race with a late tap click.
  • Dropped the design's preview.closed/return.watch/return.timed-out steps: the frame observer plus dialog-root cleanup end expanded without a timer.
  • mode.changed carries no previewable flag; the toolbar only offers the action when selectArtifactPreviewable is true.
  • Off the per-frame path except panning, which now does less work per move; no benchmark.

Screenshots

Malformed text SVG:

Before After

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none" stroke="currentColor">
  <style>
    .pan{animation:pan 3s ease-in-out infinite}
    .src{animation:src 3s step-end infinite}
    @keyframes pan{0%,100%{transform:translateX(0)}50%{transform:translateX(18px)}}
    @keyframes src{0%,49%{opacity:.35}50%,100%{opacity:1}}
    @media (prefers-reduced-motion:reduce){.pan,.src{animation:none}}
  </style>
  <rect x="8" y="8" width="104" height="56" rx="4" opacity=".35"/>
  <g class="pan"><rect x="30" y="20" width="44" height="32" rx="2" fill="currentColor" fill-opacity=".15"/><path d="M36 44l10-12 8 8 6-6 8 10"/></g>
  <rect x="128" y="8" width="104" height="56" rx="4" opacity=".35"/>
  <path d="M140 22h28M140 32h40M140 42h22" opacity=".5"/>
  <g class="src"><rect x="186" y="16" width="38" height="14" rx="3"/><path d="M194 23h22" stroke-width="2"/></g>
</svg>

Sorry, something went wrong.

Uh oh!

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

All reactions
Hona added 4 commits November 5, 2026 16:37
@Hona
fix(gui-plugins): drive the artifact viewer, image pan and video over…
93a74dd
…lay, and the select preview through state machines
@Hona
fix(gui-plugins): widen the initial image gesture state
b699b22
@Hona
fix(gui-plugins): dispatch only the threshold move, satisfy lint, and…
b74652e
… cover broken SVG source and lost pan release
@Hona
chore: format
2c02b77
@Hona
Hona requested a review from Brendonovich as a code owner November 5, 2026 06:46
Copilot AI balanced review requested due to automatic review settings November 5, 2026 06:46
Copilot AI reviewed Nov 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Sorry, something went wrong.

Uh oh!

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

All reactions
opencodejr[bot]
opencodejr Bot reviewed Nov 5, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking problems in this change. The new unit tests pass in both packages (17 in gui-plugins, 8 in ui), and tsc is clean for both. I couldn't run the Playwright component and e2e additions because the review sandbox has no browsers, so the GUI behaviour isn't verified here; the before/after screenshots in the description cover the SVG case.

In the code, the select's controlled close, a typeahead selection made while the menu is closed, the pointer-capture and click-suppression handling after a pan, and the expanded video preview's return and cleanup all look right.

Public API is unchanged; the change is limited to internal GUI components.

Sorry, something went wrong.

Uh oh!

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

All reactions
@Hona
fix(gui-plugins): keep the viewer dispatch on one line
47d8378
opencodejr[bot]
opencodejr Bot reviewed Nov 5, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit only changes how dispatchViewer is written; behaviour is the same, and tsc and the artifact viewer tests still pass. My earlier review left no open points, and this raises nothing new. Public API is unchanged.

Sorry, something went wrong.

Uh oh!

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

All reactions
@Hona
Hona merged commit c605ac3 into dev Nov 5, 2026
20 checks passed

Uh oh!

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

@Hona
Hona deleted the artifact-lows-one branch November 5, 2026 07:04
@amrkmn amrkmn mentioned this pull request Nov 7, 2026
opencode 2.2.6 amrkmn/homebrew-tap#1217
Closed
1 task
This was referenced Nov 7, 2026
feat: opencode release v2.2.6 sprisa/opencode-server#84
Merged
Tool release: OpenCode 2 v2.2.6 (was v2.2.5) agent-sh/agnix#1808
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@opencodejr opencodejr[bot] opencodejr[bot] left review comments
@Brendonovich Brendonovich Awaiting requested review from Brendonovich

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

2 participants

@Hona
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.