mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-02-11 17:55:49 +00:00
fixes
This commit is contained in:
parent
460c71ef0e
commit
b16516a450
@ -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;
|
||||
|
@ -151,6 +151,7 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
|
||||
...(message?.message || {}),
|
||||
isTemp: true,
|
||||
unread: false,
|
||||
status: message?.status
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -258,25 +258,25 @@ export const MessageItem = ({
|
||||
}} />
|
||||
)}
|
||||
|
||||
{isUpdating ? (
|
||||
{isUpdating ? (
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: "14px",
|
||||
color: "gray",
|
||||
color: "gray",
|
||||
fontFamily: "Inter",
|
||||
}}
|
||||
>
|
||||
Updating...
|
||||
{message?.status === 'failed-permanent' ? 'Failed to update' : 'Updating...'}
|
||||
</Typography>
|
||||
) : isTemp ? (
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: "14px",
|
||||
color: "gray",
|
||||
color: "gray",
|
||||
fontFamily: "Inter",
|
||||
}}
|
||||
>
|
||||
Sending...
|
||||
{message?.status === 'failed-permanent' ? 'Failed to send' : 'Sending...'}
|
||||
</Typography>
|
||||
) : (
|
||||
<Typography
|
||||
|
@ -323,10 +323,10 @@ export default ({
|
||||
attributes: {
|
||||
class: "tiptap-prosemirror",
|
||||
style:
|
||||
isMobile &&
|
||||
`overflow: auto; min-height: ${
|
||||
customEditorHeight ? "200px" : "0px"
|
||||
}; max-height:calc(100svh - ${customEditorHeight || "140px"})`,
|
||||
isMobile ?
|
||||
`overflow: auto; min-height: ${
|
||||
customEditorHeight ? "200px" : "0px"
|
||||
}; max-height:calc(100svh - ${customEditorHeight || "140px"})`: `overflow: auto; max-height: 250px`,
|
||||
},
|
||||
handleKeyDown(view, event) {
|
||||
if (!disableEnter && event.key === "Enter") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user