Skip to content

bug(chat): renaming a conversation leaves active metadata stale #2346

Description

@HanawaBanana

Chat2DB Edition

Chat2DB Community

Chat2DB Version

Current main at 7379139e.

Deployment

Web

Operating System

macOS

Operating System Version

26.5.1 (25F80)

Affected Area

AI chat conversation header and conversation list state.

Minimal Reproduction

  1. Open an existing AI chat conversation.
  2. Rename it from the editable chat header.
  3. Let POST /api/ai/chat/update complete successfully.
  4. Inspect the active conversation title or another component subscribed only to the chat list.

Expected Behavior

After the request succeeds, both the matching conversation-list entry and the active conversation for the page use the new title. The previous Zustand state remains immutable.

Actual Behavior

updateChatInfo replaces an element inside the existing chatList array and writes that same array reference back to the store. It then spreads the chat fields into the top-level currentChat page map instead of merging them into currentChat[page].

As a result, the active conversation object keeps its old title, chat fields such as id and title leak into the page map, and selectors that only observe the list can miss the update because its reference is unchanged. If the list has not loaded the conversation yet, the early return also prevents the active conversation from being updated.

Proposed Fix

Apply the successful update through an immutable state merge: map the matching list entry to a new object and merge the metadata into the matching active page slot. Add a regression contract covering state shape, immutability, and the list-not-loaded case.

Impact

Limited or cosmetic impact

Conversation renames can appear stale until another refresh or state change, despite being persisted successfully on the server.

Workaround

A reliable workaround exists

Reloading the page refreshes the persisted title from the server.

Submission Checklist

  • I reproduced this on the selected Chat2DB edition.
  • I searched existing issues for duplicates.
  • I removed credentials and private data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs/infoNeeds more information from the reporter

    Type

    No type

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions