mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-10-27 07:20:27 +01:00
Add toast deduplication and enhance provider test status notifications
This commit is contained in:
1 parent
4b5929331f
commit
7ba40483e0
3 files changed
+47
-7
No files matched your search
@@ -3,7 +3,28 @@ package toast
|
||||
templ ShowToastJS() {
|
||||
<script>
|
||||
// Notification system
|
||||
// Global tracking of shown messages to prevent duplicates
|
||||
window.shownToastMessages = window.shownToastMessages || [];
|
||||
|
||||
function showToast(message, type) {
|
||||
// Check if this exact message has been shown in the last 500ms
|
||||
const messageKey = `${message}-${type}`;
|
||||
if (window.shownToastMessages.includes(messageKey)) {
|
||||
console.log(`Preventing duplicate toast: ${messageKey}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to shown messages
|
||||
window.shownToastMessages.push(messageKey);
|
||||
|
||||
// Remove from tracking after 500ms to allow the same message later if needed
|
||||
setTimeout(() => {
|
||||
const index = window.shownToastMessages.indexOf(messageKey);
|
||||
if (index > -1) {
|
||||
window.shownToastMessages.splice(index, 1);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
const toastContainer = document.getElementById('toast-container');
|
||||
if (!toastContainer) {
|
||||
console.error("Toast container not found!");
|
||||
|
||||
Reference in new issue
Block a user