Skip to content

fix: stop conversation draft leaking into home chat input#723

Open
nehaprasad-dev wants to merge 1 commit into
OpenHands:mainfrom
nehaprasad-dev:fix/mssg-drft-zer-stat
Open

fix: stop conversation draft leaking into home chat input#723
nehaprasad-dev wants to merge 1 commit into
OpenHands:mainfrom
nehaprasad-dev:fix/mssg-drft-zer-stat

Conversation

@nehaprasad-dev
Copy link
Copy Markdown
Contributor

why

  • Stale session text and DOM showed on home after leaving a conversation.

Summary

  • Do not feed messageToSend into resize on home.
  • Clear input + messageToSend on home / conversation change; empty messageToSend does not overwrite restored draft in resize.
  • Tests updated.

Issue Number

N/A

How to Test

  • Type draft in a conversation → go home → input empty. Run npm test -- tests/hooks/use-draft-persistence.test.tsx.

Video/Screenshots

N/A

Type

[x] Bug fix

Notes

N/A

fix #717

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

@nehaprasad-dev is attempting to deploy a commit to the openhands Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taste Rating: 🟢 Good taste - Clean, surgical fix for a real UX bug.

This is a well-executed bug fix that addresses the draft leak issue with three minimal, coordinated changes:

  1. use-chat-input-logic: Returns null for messageToSend when on home (no conversationId)
  2. use-draft-persistence: Adds dedicated home/zero-state cleanup effect + clears messageToSend on conversation change
  3. use-auto-resize: Guards against restoring empty text with value.text.length > 0 check

The logic is simple and clear. Test coverage is excellent with new tests for the home state behavior. All 20 draft persistence tests pass.

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟢 LOW

This is a focused bug fix to draft state management. Changes are scoped to three hooks with no breaking changes, no data structure modifications, and no security concerns. The fix only affects behavior when conversationId is undefined (home page), which was already broken. Well-tested with passing regression coverage.

VERDICT:
Worth merging: Solves a real UX issue with minimal, well-tested changes.

KEY INSIGHT:
The fix properly distinguishes "home state" (conversationId undefined) from "conversation state" at every layer—input logic, persistence, and resize—preventing stale draft leakage with surgical precision.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/OpenHands/agent-canvas/actions/runs/26248894885

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Message draft from conversation shows up in zero state

2 participants