Fix: Force pull images in deploy workflow
All checks were successful
Build and Push / build-all (push) Successful in 7m30s
All checks were successful
Build and Push / build-all (push) Successful in 7m30s
This commit is contained in:
parent
7f56f19e94
commit
0bb461498e
7 changed files with 104 additions and 23 deletions
|
|
@ -119,8 +119,29 @@ export function clearMessages() {
|
|||
}
|
||||
|
||||
// Set message history
|
||||
export function setMessageHistory(messageList) {
|
||||
messages.set(messageList);
|
||||
// If merge=true, adds new messages to existing ones (for realm switching in global chat)
|
||||
// If merge=false (default), replaces all messages (for initial connection)
|
||||
export function setMessageHistory(messageList, merge = false) {
|
||||
if (merge) {
|
||||
messages.update((existing) => {
|
||||
// Create a Map of existing messages by messageId for O(1) lookup
|
||||
const existingMap = new Map(existing.map((m) => [m.messageId, m]));
|
||||
|
||||
// Add new messages that don't already exist
|
||||
for (const msg of messageList) {
|
||||
if (!existingMap.has(msg.messageId)) {
|
||||
existingMap.set(msg.messageId, msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert back to array and sort by timestamp
|
||||
return Array.from(existingMap.values()).sort(
|
||||
(a, b) => new Date(a.timestamp) - new Date(b.timestamp)
|
||||
);
|
||||
});
|
||||
} else {
|
||||
messages.set(messageList);
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle channel
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue