Skip to content

[Bug] New chat image attachment disappears after switching tabs #242

Closed

Description

@ImSingee

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?

  1. Open the Lody desktop app and go to New Chat.
  2. Add an image attachment to the composer.
  3. Enter some text without sending the message.
  4. Switch to another tab or page in Lody, such as an existing session.
  5. Return to New Chat.
  6. 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 chatLandingSessionStateAtomFamily with atomWithStorage, so it is restored from localStorage after returning to New Chat.
  • Image and file drafts are held in component-local state inside useChatLandingImageDraft and useChatLandingFileDraft. 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 when ChatLanding unmounts.

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

  1. added a commit that references this issue on Sep 5, 2026
    8c08fde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions