mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
Avoid calling settingStore.set when there is no legacy node bookmark (#1191)
* Avoid calling settingStore.set when there is no legacy node bookmark * nit
This commit is contained in:
@@ -15,21 +15,24 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
|
|||||||
const nodeDefStore = useNodeDefStore()
|
const nodeDefStore = useNodeDefStore()
|
||||||
|
|
||||||
const migrateLegacyBookmarks = () => {
|
const migrateLegacyBookmarks = () => {
|
||||||
settingStore
|
const legacyBookmarks = settingStore.get('Comfy.NodeLibrary.Bookmarks')
|
||||||
.get('Comfy.NodeLibrary.Bookmarks')
|
if (!legacyBookmarks.length) {
|
||||||
.forEach((bookmark: string) => {
|
return
|
||||||
// If the bookmark is a folder, add it as a bookmark
|
}
|
||||||
if (bookmark.endsWith('/')) {
|
|
||||||
addBookmark(bookmark)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const category = bookmark.split('/').slice(0, -1).join('/')
|
|
||||||
const displayName = bookmark.split('/').pop()
|
|
||||||
const nodeDef = nodeDefStore.nodeDefsByDisplayName[displayName]
|
|
||||||
|
|
||||||
if (!nodeDef) return
|
legacyBookmarks.forEach((bookmark: string) => {
|
||||||
addBookmark(`${category === '' ? '' : category + '/'}${nodeDef.name}`)
|
// If the bookmark is a folder, add it as a bookmark
|
||||||
})
|
if (bookmark.endsWith('/')) {
|
||||||
|
addBookmark(bookmark)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const category = bookmark.split('/').slice(0, -1).join('/')
|
||||||
|
const displayName = bookmark.split('/').pop()
|
||||||
|
const nodeDef = nodeDefStore.nodeDefsByDisplayName[displayName]
|
||||||
|
|
||||||
|
if (!nodeDef) return
|
||||||
|
addBookmark(`${category === '' ? '' : category + '/'}${nodeDef.name}`)
|
||||||
|
})
|
||||||
settingStore.set('Comfy.NodeLibrary.Bookmarks', [])
|
settingStore.set('Comfy.NodeLibrary.Bookmarks', [])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user