Skip to content

[Bug] 插件的 uninstall() 生命周期钩子在 v3.3.6 版本中未被触发 #16255

@lovexmm521

Description

@lovexmm521

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

插件的 uninstall() 生命周期钩子在卸载时没有被正确调用。

Expected result

我开发了一个插件,在 index.js (或 index.ts) 的 Plugin 类中定义了 uninstall() 方法。

代码如下:

JavaScript

uninstall() {
console.log("插件卸载测试 - uninstall() 被调用");
this.removeData("settings.json");
}
我打包并安装了这个插件。

我打开了开发者工具的控制台 (Console)。

我在“集市” -> “已下载”中,点击了该插件的“卸载”按钮。

预期行为:

uninstall() 方法应该被执行。

控制台应该输出 "插件卸载测试 - uninstall() 被调用" 这行日志。

实际行为:

插件被卸载了。

但是控制台没有任何日志输出,证明 uninstall() 方法没有被执行。

(如果适用)插件的 settings.json 文件也没有被删除。

备注:

我确认我的思源笔记版本高于 v2.1.0,并且我的 plugin.json 中也声明了 "minVersion": "2.1.0"。

Screenshot or screen recording presentation

No response

Version environment

- Version: 
- Operating System: 
- Browser (if used):

Log file

1

More information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions