Skip to content

Instantly share code, notes, and snippets.

@jmchilton
Created March 9, 2026 14:01
Show Gist options
  • Select an option

  • Save jmchilton/62f2a5b30bc7a4b4cc32ecd255fe07cf to your computer and use it in GitHub Desktop.

Select an option

Save jmchilton/62f2a5b30bc7a4b4cc32ecd255fe07cf to your computer and use it in GitHub Desktop.

New Chat Button Bug

Summary

"New Chat" button in ChatHistoryPanel sidebar is a no-op when user is already on /chatgxy (no exchange ID in URL).

Root Cause

ChatHistoryPanel.vue:67-75 does router.push("/chatgxy") to start a new chat. Vue Router ignores navigation to the current route, so nothing happens when already at /chatgxy.

This is the most common scenario: ChatGXY.onMounted calls loadLatestChat() which loads a conversation without updating the URL to include the exchange ID.

Working Button

ChatGXY.vue:290-305 — the main window's "New" button calls startNewChat() directly on component-local state (messages, currentChatId, query). No routing involved, always works.

Why the Sidebar Can't Do the Same

ChatHistoryPanel lives in the activity bar panel — separate component tree from ChatGXY. No shared store or event mechanism connects them, so it relies on router navigation to communicate.

When It Does Work

If the user clicked a history item first (navigating to /chatgxy/{id}), then "New Chat" pushes /chatgxy which is a route change. The exchangeId watcher fires with newId=undefined, calling startNewChat().

Fix Options

  1. Sentinel route — push /chatgxy/new, handle exchangeId === "new" in the watcher
  2. Query param with timestamprouter.push("/chatgxy?new=" + Date.now()), force unique route
  3. Shared eventwindow.dispatchEvent(new CustomEvent("chatgxy:new")), ChatGXY listens
  4. Pinia store — add a requestNewChat flag to a shared store, ChatGXY watches it

Option 1 is cleanest for this codebase — matches existing router-based pattern, minimal changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment