MCPcopy
hub / github.com/ZToolsCenter/ZTools / loadPinnedData

Function loadPinnedData

src/renderer/src/stores/commandDataStore.ts:632–658  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

630
631 // 加载固定列表数据
632 async function loadPinnedData(): Promise<void> {
633 try {
634 const [data, plugins] = await Promise.all([
635 window.ztools.dbGet(PINNED_DOC_ID),
636 window.ztools.getAllPlugins()
637 ])
638
639 if (data && Array.isArray(data)) {
640 const enabledPluginPaths = getEnabledPluginPaths(plugins)
641
642 // 过滤掉已卸载或已禁用的插件
643 const filteredData = data.filter((item: any) => {
644 if (item.type === 'plugin') {
645 return enabledPluginPaths.has(item.path)
646 }
647 return true
648 })
649
650 pinnedCommands.value = filteredData
651 } else {
652 pinnedCommands.value = []
653 }
654 } catch (error) {
655 console.error('加载固定列表失败:', error)
656 pinnedCommands.value = []
657 }
658 }
659
660 // 重新加载历史记录和固定列表(用于插件卸载后刷新)
661 async function reloadUserData(): Promise<void> {

Callers 3

initializeDataFunction · 0.85
reloadUserDataFunction · 0.85
updatePinnedOrderFunction · 0.85

Calls 3

getEnabledPluginPathsFunction · 0.85
getAllPluginsMethod · 0.80
dbGetMethod · 0.45

Tested by

no test coverage detected