-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
The plugin was not executed uninstall() when being uninstalled #16243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| if (bazaarType === "plugins") { | ||
| uninstall(app, packageName, true); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
内核推送,前端不再需要处理
| data.removePlugins.concat(data.upsertPlugins).forEach((item) => { | ||
| uninstall(app, item); | ||
| data.removePlugins.forEach((item) => { | ||
| uninstall(app, item, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前缺少 true 参数,导致没有执行插件的 uninstall() 方法
| import {getAllEditor} from "../layout/getAll"; | ||
|
|
||
| export const uninstall = (app: App, name: string, isUninstall = false) => { | ||
| export const uninstall = (app: App, name: string, isUninstall: boolean) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uninstall() 函数之前默认是不执行 uninstall 的,太迷惑人了,改成必选参数以避免以后使用时混淆用途
| // rm command | ||
| try { | ||
| plugin.onunload(); | ||
| if (isUninstall) { | ||
| plugin.uninstall(); | ||
| window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] = {}; | ||
| setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]); | ||
| } | ||
| } catch (e) { | ||
| console.error(`plugin ${plugin.name} onunload error:`, e); | ||
| } | ||
| if (isUninstall) { | ||
| try { | ||
| plugin.uninstall(); | ||
| } catch (e) { | ||
| console.error(`plugin ${plugin.name} uninstall error:`, e); | ||
| } | ||
| window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] = {}; | ||
| setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改进卸载流程
|
这个 PR 合并之后还需要合并 #16244 |
|
收到 |
fix #16156
卸载插件目前由内核推送,调用 reloadPlugin() 函数之后没有执行插件的 uninstall() 方法。