merge: gộp thành công phần code sửa trước từ stash

This commit is contained in:
2026-06-27 19:42:45 +07:00
2 changed files with 46 additions and 7 deletions
-7
View File
@@ -538,12 +538,6 @@ export const MemberDashboard: React.FC<MemberDashboardProps> = ({
useEffect(() => {
if (!user?.id) return;
<<<<<<< Updated upstream
const handleMessageReceived = (e: Event) => {
const message = (e as CustomEvent).detail;
// If we are actively chatting with the sender of this message
if (activeChatUser && (message.senderId === activeChatUser.id || message.receiverId === activeChatUser.id)) {
=======
// Connect to WebSocket: absolute URL on native, relative (Vite proxy) on web
const socket = Capacitor.isNativePlatform()
? io(BACKEND_URL)
@@ -559,7 +553,6 @@ export const MemberDashboard: React.FC<MemberDashboardProps> = ({
// Check against window-global activeChatUserId so stale closure doesn't block updates
const activeChatUserId = (window as any).activeChatUserId;
if (activeChatUserId && (message.senderId === activeChatUserId || message.receiverId === activeChatUserId)) {
>>>>>>> Stashed changes
setChatMessages(prev => [...prev, message]);
} else {
// Add to unread states