From d6caa2083f34249472c7a79073f7158f92235480 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 28 Sep 2024 12:18:46 +0800 Subject: [PATCH] :art: Improve sync plugin reload event https://github.com/siyuan-note/siyuan/issues/12433#issuecomment-2380385588 --- kernel/model/repository.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/model/repository.go b/kernel/model/repository.go index cae933716..2a90aadec 100644 --- a/kernel/model/repository.go +++ b/kernel/model/repository.go @@ -1437,6 +1437,11 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult, if strings.HasPrefix(file.Path, "/storage/petal/") { needReloadPlugin = true + if parts := strings.Split(file.Path, "/"); 3 < len(parts) { + if pluginName := parts[3]; "petals.json" != pluginName { + upsertPluginSet.Add(pluginName) + } + } } if strings.HasPrefix(file.Path, "/plugins/") { @@ -1470,6 +1475,11 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult, if strings.HasPrefix(file.Path, "/storage/petal/") { needReloadPlugin = true + if parts := strings.Split(file.Path, "/"); 3 < len(parts) { + if pluginName := parts[3]; "petals.json" != pluginName { + removePluginSet.Add(pluginName) + } + } } if strings.HasPrefix(file.Path, "/plugins/") {