Repository navigation
[Bug] New chat image attachment disappears after switching tabs #242
Description
Affected area
Desktop app
Installation method
Desktop release
Lody version or commit
0.89.0
Operating system
macOS 27.0 arm64
Agent or runtime
Not involved in this reproduction.
What happened?
On the New Chat page, when the composer contains both an image attachment and text, switching to another tab or page in Lody and then returning leaves the text intact but removes the image attachment. No visible error is shown.
This can cause the intended image context to be silently omitted if the user sends the message without noticing that the attachment disappeared.
What did you expect?
The image attachment and text should both remain in the New Chat draft until the user removes them, clears the draft, or sends the message successfully.
How can we reproduce it?
- Open the Lody desktop app and go to New Chat.
- Add an image attachment to the composer.
- Enter some text without sending the message.
- Switch to another tab or page in Lody, such as an existing session.
- Return to New Chat.
- Observe that the text is still present but the image attachment is gone.
How often does it happen?
Every time
Relevant log output
No visible error or relevant log output is shown when the attachment disappears.
Additional context
This is not limited to images. All attachment types disappear from the New Chat draft after switching away and returning, while the typed text remains.
Code inspection shows that the text and attachments have different state lifetimes:
- The text draft is stored by
chatLandingSessionStateAtomFamilywithatomWithStorage, so it is restored fromlocalStorageafter returning to New Chat. - Image and file drafts are held in component-local state inside
useChatLandingImageDraftanduseChatLandingFileDraft. On unmount, the image cleanup revokes preview object URLs and clears image state, while the file cleanup aborts active transfers and clears file state. - The reserved draft session ID is also component-local in
useChatLandingDraftSession, so it is lost whenChatLandingunmounts.
On desktop, navigating away from /chat unmounts ChatLanding. When it mounts again, the text draft is rehydrated, but the attachment drafts and reserved session ID start empty. This state-lifetime mismatch explains the observed behavior.
Before submitting
- I searched the existing issues and did not find a duplicate.
- This report concerns an open-source component in this repository, not a hosted service, Web or mobile app, account, or billing issue.
- This is not a security vulnerability; security reports follow the repository's security policy.
- I removed credentials, private source, conversations, prompts, personal data, and other sensitive information.
- If I plan to submit a pull request, I will wait for a Lody maintainer to explicitly agree on the scope and approach before implementation.
Activity
fix(components): keep New Chat attachments across tab switches