Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/api/renderer/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,22 @@ export class PluginsAPI {
plugins.splice(pluginIndex, 1)
databaseAPI.dbPut('plugins', plugins)

const history: { pluginName: string }[] = databaseAPI.dbGet('command-history') || []
const newHistory = history.filter((item) => item.pluginName !== pluginInfo.name)
if (newHistory.length !== history.length) {
databaseAPI.dbPut('command-history', newHistory)
this.mainWindow?.webContents.send('history-changed')
}

const pinned: { pluginName: string }[] = databaseAPI.dbGet('pinned-commands') || []
const newPinned = pinned.filter((item) => item.pluginName !== pluginInfo.name)
if (newPinned.length !== pinned.length) {
databaseAPI.dbPut('pinned-commands', newPinned)
this.mainWindow?.webContents.send('pinned-changed')
}

await databaseAPI.clearPluginData(pluginInfo.name)

this.mainWindow?.webContents.send('plugins-changed')

if (!pluginInfo.isDevelopment) {
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,9 @@ onMounted(async () => {
// 监听插件变化事件(安装或删除插件后刷新指令列表)
window.ztools.onPluginsChanged(async () => {
console.log('插件列表已变化,重新加载指令列表和用户数据')
// 并行刷新指令列表、历史记录和固定列表
await Promise.all([commandDataStore.loadCommands(), commandDataStore.reloadUserData()])
// 先刷新指令列表,再刷新历史/固定(历史过滤依赖最新的指令列表)
await commandDataStore.loadCommands()
await commandDataStore.reloadUserData()
})

// 监听更新下载完成事件
Expand Down