Skip to content

Commit

Permalink
Remove node bookmark migration (#1733)
Browse files Browse the repository at this point in the history
* Remove node bookmarks setting migration

* nit

* nit
  • Loading branch information
huchenlei authored Nov 28, 2024
1 parent df3fff5 commit 814c4b8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 47 deletions.
17 changes: 0 additions & 17 deletions browser_tests/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,23 +350,6 @@ test.describe('Menu', () => {
await comfyPage.page.waitForTimeout(1000)
expect(await tab.getNode('KSampler (Advanced)').count()).toBe(2)
})

test('Can migrate legacy bookmarks', async ({ comfyPage }) => {
await comfyPage.setSetting('Comfy.NodeLibrary.Bookmarks', [
'foo/',
'foo/KSampler (Advanced)',
'UNKNOWN',
'KSampler'
])
await comfyPage.setSetting('Comfy.NodeLibrary.Bookmarks.V2', [])
await comfyPage.reload()
expect(await comfyPage.getSetting('Comfy.NodeLibrary.Bookmarks')).toEqual(
[]
)
expect(
await comfyPage.getSetting('Comfy.NodeLibrary.Bookmarks.V2')
).toEqual(['foo/', 'foo/KSamplerAdvanced', 'KSampler'])
})
})

test.describe('Workflows sidebar', () => {
Expand Down
27 changes: 1 addition & 26 deletions src/stores/nodeBookmarkStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,6 @@ export const BOOKMARK_SETTING_ID = 'Comfy.NodeLibrary.Bookmarks.V2'
export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
const settingStore = useSettingStore()
const nodeDefStore = useNodeDefStore()

const migrateLegacyBookmarks = () => {
const legacyBookmarks = settingStore.get('Comfy.NodeLibrary.Bookmarks')
if (!legacyBookmarks.length) {
return
}

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', [])
}

const bookmarks = computed<string[]>(() =>
settingStore.get(BOOKMARK_SETTING_ID)
)
Expand Down Expand Up @@ -225,8 +202,6 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
deleteBookmarkCustomization,
renameBookmarkCustomization,
defaultBookmarkIcon,
defaultBookmarkColor,

migrateLegacyBookmarks
defaultBookmarkColor
}
})
4 changes: 0 additions & 4 deletions src/views/GraphView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import TopMenubar from '@/components/topbar/TopMenubar.vue'
import { setupAutoQueueHandler } from '@/services/autoQueueService'
import { useKeybindingStore } from '@/stores/keybindingStore'
import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore'
import { useNodeBookmarkStore } from '@/stores/nodeBookmarkStore'
import { useNodeDefStore, useNodeFrequencyStore } from '@/stores/nodeDefStore'
import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
import { useModelStore } from '@/stores/modelStore'
Expand Down Expand Up @@ -171,9 +170,6 @@ const onGraphReady = () => {
// Load model folders
useModelStore().loadModelFolders()
// Migrate legacy bookmarks
useNodeBookmarkStore().migrateLegacyBookmarks()
// Node defs now available after comfyApp.setup.
// Explicitly initialize nodeSearchService to avoid indexing delay when
// node search is triggered
Expand Down

0 comments on commit 814c4b8

Please sign in to comment.