mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 14:42:11 -03:00
feat: prevent duplicate banner entries in recent history
Add duplicate detection to banner recording to prevent multiple entries for the same banner ID in recent history. This prevents duplicate history entries when pages refresh or banners are shown multiple times. - Check if banner ID already exists in recentHistory before adding - Return early if duplicate found to prevent adding same banner multiple times - Add comprehensive tests for banner history functionality including: - Adding new banners to history - Preventing duplicate entries - Handling multiple different banners - Clear history between tests to ensure test isolation
This commit is contained in:
@@ -348,6 +348,13 @@ class BannerService {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if banner with this ID already exists in recent history
|
||||
// Only record if it's not already in history (prevents duplicates on page refresh)
|
||||
const existingEntry = this.recentHistory.find(entry => entry.id === banner.id);
|
||||
if (existingEntry) {
|
||||
return; // Banner already exists in history, don't add again
|
||||
}
|
||||
|
||||
const sanitizedActions = Array.isArray(banner.actions)
|
||||
? banner.actions.map(action => ({
|
||||
text: action.text,
|
||||
|
||||
Reference in New Issue
Block a user