Appearance
Type Deep Dive — Runtime Workspace And Unread
1. Detail workspace hiện là shell mỏng
ConversationDetail chỉ làm 3 việc:
- nhận
idtừ route, - truyền
conversationIdvàoConversation, - giữ
RouterViewcho nhánh con (ConversationDetail.tsx:22).
Nó có handleVideoCall() để push sang ROUTE_CONVERSATION_CONFERENCE, nhưng việc này mới chỉ là intent ở page layer.
2. Header workspace chưa phát video event
Conversation component:
- nhận prop theo
useConversationMessagesProps, - emit
"video", - render
QBtnicon camera, - nhưng button không có
onClicknào (Conversation/index.tsx:23).
Nghĩa là ConversationDetail có truyền onVideo={handleVideoCall}, nhưng Conversation hiện không phát sự kiện này.
3. Conversation list có unread/read intent nhưng chưa chạy được
Điều list đang cố làm
| Hành vi | Source |
|---|---|
click item -> update conversation_member.read_at của user hiện tại | ConversationList.tsx:57 |
sau đó emit select(item.id) | ConversationList.tsx:79 |
infinite scroll với offset, debounce, onLoad | ConversationList.tsx:116 |
unread badge cap ở 9+ | ConversationList.tsx:168 |
Vấn đề
useUpdateConversationMembersMutation() ở cuối file chỉ:
throw new Error("Function not implemented.")
(ConversationList.tsx:188)
Do đó mọi click item có khả năng làm vỡ runtime ngay tại FE, trừ khi compile/build tree somehow tree-shake path này ngoài runtime.
4. Message stream có render nhưng chưa có send path
ConversationMessages đã có:
- reverse infinite scroll,
- map
msg.user_id -> user, - relative time cho message mới,
- composer với
QForm+QInput+ send button.
Nhưng handleChatEnter() hiện chỉ:
- check
chatMessage.value, returnluôn (ConversationMessages.tsx:92).
Không có mutation, không có store update optimistic, không có provider send path.
5. Store và merge logic
useConversationStore
| Action | Vai trò |
|---|---|
updateConversations(items) | merge theo id, sort theo last_message_created_at |
updateConversationCursor(items) | giữ cursor cũ nhất của batch conversations |
updateConversationMessages(messages) | group theo conversation_id rồi merge từng group |
addConversationCursor(data) | helper gộp list + cursor |
Utility merge message
mergeSortedConversationMessages() không append mù. Nó so sánh created_at, tạo left/middle/right segments và tránh duplicate theo id (utils.ts:1). Đây là điểm đáng giữ vì nó phản ánh design intent cho streaming/pagination dù shell FE còn thiếu.
6. Findings kỹ thuật
| ID | Mức độ | Mô tả |
|---|---|---|
| RW-F01 | Cao | Conversation không emit video event vì QBtn chưa có onClick, làm page-level handler vô dụng (Conversation/index.tsx:23). |
| RW-F02 | Cao | ConversationList dùng mutation stub và có thể nổ runtime ngay khi user click item (ConversationList.tsx:188). |
| RW-F03 | Cao | Composer trong ConversationMessages không gửi message thật; UI đang tạo kỳ vọng sai về khả năng chat realtime (ConversationMessages.tsx:92). |
| RW-F04 | Trung bình | useConversation.ts rỗng và ConversationProvider pass-through, cho thấy module chưa có orchestration layer đủ trưởng thành (useConversation.ts:1, ConversationProvider.tsx:12). |