cmd_sidechat_create: check + first, open panel only if needed\n\nAvoids unnecessary switcher click when panel already open.
This commit is contained in:
@@ -270,7 +270,13 @@ def cmd_sidechat_create(ws):
|
|||||||
- + button: [data-testid="hatch-chat-compose"] (SVG icon, no text)
|
- + button: [data-testid="hatch-chat-compose"] (SVG icon, no text)
|
||||||
"""
|
"""
|
||||||
import time as _time
|
import time as _time
|
||||||
# Open chat panel via switcher trigger (idempotent - safe if already open)
|
# Check if + button already present (panel open). If not, open via switcher.
|
||||||
|
# Fixed 2026-10-04: don't blindly click switcher, check state first.
|
||||||
|
has_plus = ev(ws, """(() => {
|
||||||
|
return !!document.querySelector('[data-testid="hatch-chat-compose"]');
|
||||||
|
})()""")
|
||||||
|
if not has_plus:
|
||||||
|
# Panel closed, open via switcher trigger
|
||||||
sw_result = ev(ws, """(() => {
|
sw_result = ev(ws, """(() => {
|
||||||
const sw = document.querySelector('[data-testid="hatch-chat-switcher-trigger"]');
|
const sw = document.querySelector('[data-testid="hatch-chat-switcher-trigger"]');
|
||||||
if (sw) sw.click();
|
if (sw) sw.click();
|
||||||
|
|||||||
Reference in New Issue
Block a user