mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 06:32:12 -03:00
Refactor storage handling across application
- Introduced a new storageHelpers module to centralize localStorage interactions, improving code maintainability and readability. - Updated various components and managers to utilize the new storageHelpers functions for setting, getting, and removing items from localStorage. - Added migration logic to handle localStorage items during application initialization, ensuring compatibility with the new storage structure. - Enhanced logging during application initialization for better debugging.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { updatePanelPositions } from "../utils/uiHelpers.js";
|
||||
import { getCurrentPageState } from "../state/index.js";
|
||||
import { setStorageItem, getStorageItem } from "../utils/storageHelpers.js";
|
||||
/**
|
||||
* SearchManager - Handles search functionality across different pages
|
||||
* Each page can extend or customize this base functionality
|
||||
@@ -183,7 +184,7 @@ export class SearchManager {
|
||||
|
||||
loadSearchPreferences() {
|
||||
try {
|
||||
const preferences = JSON.parse(localStorage.getItem(`${this.currentPage}_search_prefs`)) || {};
|
||||
const preferences = getStorageItem(`${this.currentPage}_search_prefs`) || {};
|
||||
|
||||
// Apply search options
|
||||
if (preferences.options) {
|
||||
@@ -254,7 +255,7 @@ export class SearchManager {
|
||||
preferences.recursive = this.recursiveSearchToggle.checked;
|
||||
}
|
||||
|
||||
localStorage.setItem(`${this.currentPage}_search_prefs`, JSON.stringify(preferences));
|
||||
setStorageItem(`${this.currentPage}_search_prefs`, preferences);
|
||||
} catch (error) {
|
||||
console.error('Error saving search preferences:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user