fix(web): HWLAB #748 initCommandBar orphan el.commandNewSession listener (#752)

PR #746 (#744) removed the duplicate `command-new-session` button from index.html and the `el.commandNewSession` field from the `el` literal, but left `el.commandNewSession.addEventListener("click", ...)` inside `initCommandBar()`. The resulting undefined reference crashed every Cloud Workbench init with

  app.js:5414 Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')
      at initCommandBar (app.js:5414:24)
      at app.js:3538:1

The new session entry point is `#session-create` in the session sidebar (added in #740/#743), so this listener is no longer needed. Removal is the minimal fix; all other command-bar bindings (`commandInput`, `commandForm`, `commandClear`) are untouched.

Verified locally:
  - web:check (54 tests pass, all static contracts pass)
  - web:build (12 dist files fresh)
  - dist/app.js: 0 references to commandNewSession

Refs: pikasTech/HWLAB#748

Co-authored-by: Codex <codex@local>
This commit is contained in:
Lyon
2026-06-03 14:45:26 +08:00
committed by GitHub
parent 1a85f302c6
commit 9d71bf5f6b
-8
View File
@@ -55,14 +55,6 @@ function initCommandBar() {
await submitAgentMessage(value);
});
el.commandNewSession.addEventListener("click", () => {
createManualAgentSession().catch((error) => {
state.sessionStatus = "failed";
renderAgentChatStatus("failed", { error });
renderCodeAgentSummary();
});
});
el.commandClear.addEventListener("click", () => {
for (const close of state.traceStreams.values()) close();
state.traceStreams.clear();