fix(frontend): resolve false error when moving chat to folder (#827)
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
-
Duplicate API call —
ChatFolders.handleMoveChat()calledchatHistoryService.moveConversation()directly and then dispatched the store actionmoveChat, which re-issued the same API call (the endpoint fired twice). -
Cascading failure —
chatHistoryStore.moveChattreated the post-movegetFolder()refresh as part of the move transaction. A network/race failure there — or an unexpected folder shape (conversationsundefined) — 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 directmoveConversation()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)