mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
feat(context-menu): prevent duplicate NSFW selector initialization
Add initialization tracking to prevent multiple event listener attachments in context menu components. Use dataset.initialized flag to ensure NSFW selector events are only set up once per component instance. In ModelContextMenuMixin, replace DOM elements and reattach event listeners to avoid duplicates when components are reinitialized. This fixes issues where multiple click handlers could be attached to the same elements.
This commit is contained in:
@@ -11,9 +11,10 @@ export class CheckpointContextMenu extends BaseContextMenu {
|
||||
this.modelType = 'checkpoint';
|
||||
this.resetAndReload = resetAndReload;
|
||||
|
||||
// Initialize NSFW Level Selector events
|
||||
if (this.nsfwSelector) {
|
||||
// Initialize NSFW Level Selector events only if not already initialized
|
||||
if (this.nsfwSelector && !this.nsfwSelector.dataset.initialized) {
|
||||
this.initNSFWSelector();
|
||||
this.nsfwSelector.dataset.initialized = 'true';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user