mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-09 01:20:09 +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 migrateLegacyBookmarks = () => {
|
||||
settingStore
|
||||
.get('Comfy.NodeLibrary.Bookmarks')
|
||||
.forEach((bookmark: string) => {
|
||||
// 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]
|
||||
const legacyBookmarks = settingStore.get('Comfy.NodeLibrary.Bookmarks')
|
||||
if (!legacyBookmarks.length) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!nodeDef) return
|
||||
addBookmark(`${category === '' ? '' : category + '/'}${nodeDef.name}`)
|
||||
})
|
||||
legacyBookmarks.forEach((bookmark: string) => {
|
||||
// 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', [])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user