diff --git a/src/MessageQueueContext.tsx b/src/MessageQueueContext.tsx
index 166a4c3..67841de 100644
--- a/src/MessageQueueContext.tsx
+++ b/src/MessageQueueContext.tsx
@@ -11,7 +11,7 @@ let messageQueue = []; // Global message queue
export const MessageQueueProvider = ({ children }) => {
const [queueChats, setQueueChats] = useState({}); // Stores chats and status for display
const isProcessingRef = useRef(false); // To track if the queue is being processed
- const maxRetries = 4;
+ const maxRetries = 3;
const clearStatesMessageQueueProvider = useCallback(() => {
setQueueChats({});
messageQueue = [];
@@ -43,7 +43,8 @@ export const MessageQueueProvider = ({ children }) => {
];
// Start processing the queue if not already processing
- processQueue();
+ processQueue([], groupDirectId);
+
}, []);
// Method to process with new messages and groupDirectId
@@ -68,6 +69,10 @@ export const MessageQueueProvider = ({ children }) => {
return !newMessages.some(newMsg => newMsg?.specialId === chat?.message?.specialId);
});
+ updatedChats[groupDirectId] = updatedChats[groupDirectId].filter((chat) => {
+ return chat?.status !== 'failed-permanent'
+ });
+
// If no more chats for this group, delete the groupDirectId entry
if (updatedChats[groupDirectId].length === 0) {
delete updatedChats[groupDirectId];
@@ -137,9 +142,9 @@ export const MessageQueueProvider = ({ children }) => {
messageQueue = messageQueue.slice(1); // Slice for failed messages after max retries
// Remove the message from queueChats after failure
- updatedChats[groupDirectId] = updatedChats[groupDirectId].filter(
- (item) => item.identifier !== identifier
- );
+ // updatedChats[groupDirectId] = updatedChats[groupDirectId].filter(
+ // (item) => item.identifier !== identifier
+ // );
}
}
return updatedChats;
diff --git a/src/components/Chat/ChatList.tsx b/src/components/Chat/ChatList.tsx
index 284fc6f..76a29fa 100644
--- a/src/components/Chat/ChatList.tsx
+++ b/src/components/Chat/ChatList.tsx
@@ -151,6 +151,7 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
...(message?.message || {}),
isTemp: true,
unread: false,
+ status: message?.status
};
}
diff --git a/src/components/Chat/MessageItem.tsx b/src/components/Chat/MessageItem.tsx
index 681130b..c37f7a5 100644
--- a/src/components/Chat/MessageItem.tsx
+++ b/src/components/Chat/MessageItem.tsx
@@ -258,25 +258,25 @@ export const MessageItem = ({
}} />
)}
- {isUpdating ? (
+ {isUpdating ? (
- Updating...
+ {message?.status === 'failed-permanent' ? 'Failed to update' : 'Updating...'}
) : isTemp ? (
- Sending...
+ {message?.status === 'failed-permanent' ? 'Failed to send' : 'Sending...'}
) : (