Skip to content

Commit

Permalink
Rename settingStore.settings to settingsById
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Dec 28, 2024
1 parent ab33eb6 commit 07de5e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/dialog/content/SettingDialogContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
)
})
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/ui/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/stores/settingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('.')
Expand All @@ -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)
Expand Down Expand Up @@ -92,7 +92,7 @@ export const useSettingStore = defineStore('setting', () => {

return {
settingValues,
settings,
settingsById,
settingTree,
addSettings,
loadExtensionSettings,
Expand Down
2 changes: 1 addition & 1 deletion src/stores/workspaceStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}))
Expand Down

0 comments on commit 07de5e0

Please sign in to comment.