mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 06:19:58 +00:00
[Refactor] Rename settingStore.settings to settingsById (#2081)
This commit is contained in:
@@ -188,7 +188,7 @@ const searchResults = computed<ISettingGroup[]>(() => {
|
||||
const groupedSettings: { [key: string]: SettingParams[] } = {}
|
||||
|
||||
filteredSettingIds.value.forEach((id) => {
|
||||
const setting = settingStore.settings[id]
|
||||
const setting = settingStore.settingsById[id]
|
||||
const info = getSettingInfo(setting)
|
||||
const groupLabel = info.subCategory
|
||||
|
||||
@@ -215,7 +215,7 @@ const searchResults = computed<ISettingGroup[]>(() => {
|
||||
const searchResultsCategories = computed<Set<string>>(() => {
|
||||
return new Set(
|
||||
filteredSettingIds.value.map(
|
||||
(id) => getSettingInfo(settingStore.settings[id]).category
|
||||
(id) => getSettingInfo(settingStore.settingsById[id]).category
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ComfySettingsDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
private tryMigrateDeprecatedValue(id: string, value: any) {
|
||||
if (this.app.vueAppReady) {
|
||||
const settingStore = useSettingStore()
|
||||
const setting = settingStore.settings[id]
|
||||
const setting = settingStore.settingsById[id]
|
||||
if (setting?.migrateDeprecatedValue) {
|
||||
return setting.migrateDeprecatedValue(value)
|
||||
}
|
||||
@@ -149,7 +149,7 @@ export class ComfySettingsDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
|
||||
this.settingsParamLookup[id] = params
|
||||
if (this.app.vueAppReady) {
|
||||
useSettingStore().settings[id] = params
|
||||
useSettingStore().settingsById[id] = params
|
||||
}
|
||||
this.settingsLookup[id] = {
|
||||
id,
|
||||
|
||||
@@ -33,11 +33,11 @@ export interface SettingTreeNode extends TreeNode {
|
||||
|
||||
export const useSettingStore = defineStore('setting', () => {
|
||||
const settingValues = ref<Record<string, any>>({})
|
||||
const settings = ref<Record<string, SettingParams>>({})
|
||||
const settingsById = ref<Record<string, SettingParams>>({})
|
||||
|
||||
const settingTree = computed<SettingTreeNode>(() => {
|
||||
const root = buildTree(
|
||||
Object.values(settings.value).filter(
|
||||
Object.values(settingsById.value).filter(
|
||||
(setting: SettingParams) => setting.type !== 'hidden'
|
||||
),
|
||||
(setting: SettingParams) => setting.category || setting.id.split('.')
|
||||
@@ -62,7 +62,7 @@ export const useSettingStore = defineStore('setting', () => {
|
||||
const value = settingsDialog.getSettingValue(id)
|
||||
settingValues.value[id] = value
|
||||
}
|
||||
settings.value = settingsDialog.settingsParamLookup
|
||||
settingsById.value = settingsDialog.settingsParamLookup
|
||||
|
||||
CORE_SETTINGS.forEach((setting: SettingParams) => {
|
||||
settingsDialog.addSetting(setting)
|
||||
@@ -92,7 +92,7 @@ export const useSettingStore = defineStore('setting', () => {
|
||||
|
||||
return {
|
||||
settingValues,
|
||||
settings,
|
||||
settingsById,
|
||||
settingTree,
|
||||
addSettings,
|
||||
loadExtensionSettings,
|
||||
|
||||
@@ -26,7 +26,7 @@ export const useWorkspaceStore = defineStore('workspace', () => {
|
||||
}))
|
||||
const sidebarTab = computed(() => useSidebarTabStore())
|
||||
const setting = computed(() => ({
|
||||
settings: useSettingStore().settings,
|
||||
settings: useSettingStore().settingsById,
|
||||
get: useSettingStore().get,
|
||||
set: useSettingStore().set
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user