Skip to content

fix(frontend): resolve false error when moving chat to folder (#827)

Jérôme Revillard requested to merge fix/827-move-chat-folder-client-error into main

Summary

Fixes the false "Failed to move conversation" error reported in #827 (closed). The move succeeded on the backend (HTTP 200, folderConversations edge created) but the frontend showed an error toast.

Root cause

  1. Duplicate API callChatFolders.handleMoveChat() called chatHistoryService.moveConversation() directly and then dispatched the store action moveChat, which re-issued the same API call (the endpoint fired twice).

  2. Cascading failurechatHistoryStore.moveChat treated the post-move getFolder() refresh as part of the move transaction. A network/race failure there — or an unexpected folder shape (conversations undefined) — threw and propagated to the component's catch block, showing the error toast even though the move had already succeeded.

Changes

  • ChatFolders.vue (handleMoveChat): removed the duplicate direct moveConversation() call. The store action now owns the API call + state sync.
  • chatHistoryStore.js (moveChat):
    • commit('MOVE_CHAT', …) now runs immediately after the authoritative move succeeds, so local state reflects the move regardless of the folder refresh.
    • The getFolder() refresh is now best-effort (caught + logged) — a failure there no longer fails the move.
    • Null-guarded folder.conversations ((folder?.conversations || []).map(...)).
  • chatHistory.test.js: two regression tests covering both failure modes.

Testing

  • New regression tests fail against the unfixed code, pass after the fix.
  • Full frontend Jest suite: 1203 passed, 0 failed (51 suites).
  • ESLint + Prettier clean on all changed files.

Closes #827 (closed)

Merge request reports

Loading