refactor(max): move homepage hands-free start into a logic listener#60783
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Reviews (1): Last reviewed commit: "refactor(max): move homepage hands-free ..." | Re-trigger Greptile |
|
Size Change: 0 B Total Size: 80.8 MB ℹ️ View Unchanged
|
|
🎭 Playwright report · View test results →
These issues are not necessarily caused by your changes. |
|
Note 🤖 Automated comment by QA Swarm — not written by a human Multi-perspective review: qa-team (specialists + generalists), paul-reviewer, xp-reviewer, security-audit Verdict: 💬 APPROVE WITH NITSClean, low-risk refactor — the mic button's inline Convergence (highest confidence)
Nits (non-blocking, not addressed in this PR)
Reviewer summaries
Automated by QA Swarm — not a human review |
|
✅ Visual changes approved by @pauldambra — baseline updated in 2 changed. |
The homepage idle mic button fired four calls inline in its onClick
handler: capture, startNewConversation, submitQuery('ai'), enterHandsFree.
That is business logic living in a React handler.
Give aiFirstHomepageLogic a startHandsFreeChat action whose listener owns
the sequence, and connect handsFreeLogic's enterHandsFree so the whole flow
lives in one place. The ordering the original relied on is preserved
(synchronous action calls in the same order). The button is now just
onClick={startHandsFreeChat}; the handsFreeAvailable render gate stays in
the component.
Generated-By: PostHog Code
Task-Id: 24894780-dfaf-4242-9ceb-db6893f4ec40
The comment claimed startNewConversation made submitQuery's create-on-demand branch skip, but startNewConversation nulls conversationId via a reducer, so the branch is actually taken (a harmless second startNewConversation). Reword to state the real intent: clear any in-progress conversation so hands-free always starts a fresh thread. Generated-By: PostHog Code Task-Id: 24894780-dfaf-4242-9ceb-db6893f4ec40
402074e to
6ed348d
Compare

Problem
The homepage idle-input mic button (added in #60122) fired four calls inline in its
onClickhandler:posthog.capture,startNewConversation(),submitQuery('ai'), andenterHandsFree(). That is business logic living in a React handler, which our frontend convention asks us to keep in the kea logic instead.Changes
startHandsFreeChataction toaiFirstHomepageLogicwhose listener owns the full sequence, andconnecthandsFreeLogic'senterHandsFreeso the flow lives in one place.onClick={startHandsFreeChat}.handsFreeAvailablerender gate stays in the component (a render concern).No behaviour change — the listener makes the same synchronous action calls in the same order the click handler did, so the ordering the original relied on (fresh conversation before AI-mode transition before Scribe starts) is preserved.
How did you test this code?
I'm an agent. I regenerated kea typegen (
pnpm typegen:write, exit 0 with--show-ts-errors) and confirmedaiFirstHomepageLogicType.tsnow carries bothstartHandsFreeChatand the connectedenterHandsFree. No automated test covers this interaction directly; I did not perform manual browser testing.🤖 Agent context
Authored with PostHog Code. This is a small follow-up refactor to #60122 (which merged before the change landed): it relocates the mic button's inline
onClicksequence into a singlestartHandsFreeChatlistener onaiFirstHomepageLogic. Considered keeping it in the handler vs. moving to the logic; moved it to honour the "business logic in kea, not React handlers" convention. Ordering betweenstartNewConversation/submitQuery('ai')/enterHandsFreewas preserved deliberately and documented in a code comment.Created with PostHog Code