Skip to content

Panel close button triggers location.reload() (full page reload) and reuses the full-width toggle style #8

Description

@StarChen-Cycler

Environment

  • dsh-genui 0.8.2, installed via dsh plugin --profile web add git+https://github.com/omdsh-dev/dsh-genui.git
  • DeepSeek Harness 0.1.0-rc.6, web profile, Windows

Problem

  1. Clicking the panel's close (✕) button reloads the entire page. The handler ends with location.reload(), so the whole app reboots instead of the panel simply dismissing. Users perceive this as "the harness restarted when I clicked close".
  2. The ✕ button reuses the header toggle's CSS class, so it renders as a huge stretched area (full width + large padding) for a tiny glyph.

The shipped lib/client.js (dock component registered in conversation.input.dock) contains:

(0,g.jsx)(`button`,{type:`button`,className:C.panelToggle,title:`关闭面板`,"aria-label":`关闭面板`,onClick:()=>{try{let t=JSON.parse(localStorage.getItem(`dsh.genui.panel`)??`null`);if(t&&typeof t===`object`){delete t.sessions?.[e];t.order=Array.isArray(t.order)?t.order.filter(x=>x!==e):[];localStorage.setItem(`dsh.genui.panel`,JSON.stringify(t))}}catch{};location.reload()},children:`✕`})

Both className:C.panelToggle and the trailing location.reload() are the problems.

Proposed fix (verified locally)

The plugin already has the correct primitive: the /panel clear path calls un(sessionId, null), which updates the in-memory store, persists to localStorage, and notifies subscribers — the panel unmounts immediately with no navigation. Reuse it:

onClick:()=>un(e,null)

And give the ✕ its own compact class instead of panelToggle (add a panelClose entry to the CSS-module map, then this CSS):

.V1MMBW_panelClose{flex:0 0 auto;width:26px;height:26px;margin-right:8px;display:flex;align-items:center;justify-content:center;border:0;border-radius:6px;background:transparent;color:inherit;font-size:13px;line-height:1;cursor:pointer;padding:0;opacity:.65}
.V1MMBW_panelClose:hover{background:#ffffff14;opacity:1}

Test results (patch applied to the built bundle)

  • Before: clicking ✕ → full page reload; ✕ hit area spans a large stretch of the header.
  • After: clicking ✕ → panel disappears in place instantly; session, scroll position and app state all preserved; no reload.
  • Closing persists: after a refresh the panel stays closed (same localStorage semantics as /panel clear).
  • Verified the served bundle no longer contains location.reload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions