Skip to content

Cannot return when plugin loadData is empty #8259

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

Closed
TinkMingKing opened this issue May 15, 2023 · 1 comment
Closed

Cannot return when plugin loadData is empty #8259

TinkMingKing opened this issue May 15, 2023 · 1 comment
Assignees
Milestone

Comments

@TinkMingKing
Copy link
Contributor

TinkMingKing commented May 15, 2023

In what scenarios do you need this feature?

bug

插件执行如下方法,第一次会log输出空值,这是正常的,可如果此时再重载(重启)思源,不会有任何输出,也未显示报错,应该是文件为空时读取报错了,但是没有打印

async test(){
    await this.loadData("123");
    this.saveData("123", "");
    await this.loadData("123");
    console.log(this.data["123"]);
}

features

  1. 卸载插件时应该删除/data/storage/petal下对应的插件文件夹,否则未来可能会产生错误
  2. 应该提供类似deleteData()这样的删除api,便于开发者删除无用的、错误的data文件
  3. 应该提供类似onUpdate(){}这样的方法,当用户更新插件后,只执行一次,便于开发者升级配置,以及修复之前版本的错误,如果产生错误,用户只能够通过卸载重装来实现,过于麻烦且用户不一定想得到
  4. 可以提供initData()方法供开发者预置数据

Describe the optimal solution

Describe the candidate solution

No response

Other information

No response

@Vanessa219
Copy link
Member

bug 已重现,稍后修复

  1. 用户数据不应该删除,这样再次安装的时候还会有原来的数据
  2. Frontend API #5066
  3. 可以在 onload 时对升级数据进行兼容处理
  4. 默认值可用常量直接置于代码中,这样也不会和 data 有所冲突

@Vanessa219 Vanessa219 changed the title Improvement of the plugin's uninstallation process||插件api bug修复及方法改进 Cannot return when loadData is empty May 15, 2023
@Vanessa219 Vanessa219 self-assigned this May 15, 2023
@Vanessa219 Vanessa219 added the Bug label May 15, 2023
@Vanessa219 Vanessa219 added this to the 2.8.8 milestone May 15, 2023
Vanessa219 added a commit that referenced this issue May 15, 2023
@88250 88250 added Development and removed Bug labels May 16, 2023
@88250 88250 changed the title Cannot return when loadData is empty Cannot return when plugin loadData is empty May 16, 2023
@88250 88250 changed the title Cannot return when plugin loadData is empty Cannot return when plugin loadData is empty May 16, 2023
Zuoqiu-Yingyi added a commit to Zuoqiu-Yingyi/siyuan that referenced this issue May 16, 2023

Verified

This commit was signed with the committer’s verified signature.
Zuoqiu-Yingyi Yingyi / 颖逸
commit a335101
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 12:53:33 2023 +0800

    :bookmark: Release v2.8.8

commit 6a6dec0
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 11:30:33 2023 +0800

    :memo: Update changelogs

commit a819656
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 11:15:53 2023 +0800

    :memo: Update changelogs

commit 56a2c36
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 11:11:54 2023 +0800

    :bug: Remove inconsistent scroll IAL

commit 8b6abec
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 10:39:48 2023 +0800

    :art: Bazaar resource directories support symlink siyuan-note#8263

commit 9455086
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 10:35:46 2023 +0800

    :memo: Update changelogs

commit fdbfe6b
Author: 颖逸 <49649786+Zuoqiu-Yingyi@users.noreply.github.com>
Date:   Tue May 16 10:34:38 2023 +0800

    Bazaar resource directories support symlink (siyuan-note#8263)

    * 🎨 bazaar resource directories support symlink

    * 🎨 bazaar resource directories support symlink

commit 8549634
Author: Vanessa <lly219@gmail.com>
Date:   Tue May 16 10:31:01 2023 +0800

    :sparkles: enable plugin

commit f3d1acd
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 09:39:01 2023 +0800

    :memo: Update changelogs

commit bf4b88a
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 09:38:50 2023 +0800

    :art: Plugin hot load

commit 516276d
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 09:09:31 2023 +0800

    :art: Data sync connectivity check supports redirection Fix siyuan-note#8264

commit d24f5ae
Author: Vanessa <lly219@gmail.com>
Date:   Tue May 16 00:05:18 2023 +0800

    :rotating_light:

commit 1ac623e
Author: Vanessa <lly219@gmail.com>
Date:   Tue May 16 00:04:25 2023 +0800

    :art: fix siyuan-note#8258

commit fdf9f0d
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 22:33:36 2023 +0800

    :art: siyuan-note#5066 removeData

commit 7c7f3db
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 22:26:11 2023 +0800

    :bug: fix siyuan-note#8259

commit ba4e5e8
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 19:59:13 2023 +0800

    :lipstick: fix siyuan-note#8260

commit 4f099bd
Merge: b892fad 856c7e0
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 19:35:33 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit b892fad
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 19:35:19 2023 +0800

    :lipstick:

commit 856c7e0
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 18:48:33 2023 +0800

    :memo: Improve initialization data sync interaction siyuan-note#8220

commit ab6cb33
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 18:41:51 2023 +0800

    :memo: Improve initialization data sync interaction siyuan-note#8220

commit a759936
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 16:02:58 2023 +0800

    :memo: Improve initialization data sync interaction siyuan-note#8220

commit 2513cbc
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 15:53:46 2023 +0800

    :memo: Improve initialization data sync interaction siyuan-note#8220

commit 9a03f1e
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 15:52:00 2023 +0800

    :memo: Update changelogs

commit 4cb9523
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 15:51:31 2023 +0800

    :art: siyuan-note#8220

commit 7d58ab0
Merge: 6ca6817 0a10285
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 15:43:33 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit 6ca6817
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 15:43:16 2023 +0800

    :art: siyuan-note#8220

commit 0a10285
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 14:56:12 2023 +0800

    :art: Escape the notification message siyuan-note#7811

commit 7dbfa43
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 13:59:50 2023 +0800

    :art: siyuan-note#8220

commit 15141dd
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 13:54:30 2023 +0800

    :art: siyuan-note#8220

commit dc1941d
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 12:11:45 2023 +0800

    :art: catch plugin load

commit e728818
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 12:04:22 2023 +0800

    :art: catch plugin load

commit 6690084
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 11:46:51 2023 +0800

    :art: fix siyuan-note#8256

commit 53a95ff
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 00:27:27 2023 +0800

    :lipstick: account

commit 4c7fe24
Merge: 3674e83 2cf8a81
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 00:11:08 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit 3674e83
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 00:10:46 2023 +0800

    :lipstick: account

commit 2cf8a81
Author: Liang Ding <d@b3log.org>
Date:   Sun May 14 23:21:32 2023 +0800

    :art: Improve images render in the marketplace package siyuan-note/bazaar#1119

commit 7572db4
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 12:10:47 2023 +0800

    :art: fix siyuan-note#8216

commit 1807163
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 12:09:52 2023 +0800

    :art: fix siyuan-note#8216

commit 300a60a
Merge: 0b00159 a6ecb98
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 11:50:55 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit 0b00159
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 11:50:41 2023 +0800

    :bug: open new window

commit a6ecb98
Author: Liang Ding <d@b3log.org>
Date:   Sun May 14 11:43:54 2023 +0800

    :art: Sponsorship through the Open Collective is no longer supported

commit 6c3c8d4
Author: Liang Ding <d@b3log.org>
Date:   Sun May 14 10:44:39 2023 +0800

    :art: When multiple windows exist, each window should be isolated using the `Optimize Typesetting` siyuan-note#8216

commit 3edd823
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:34:48 2023 +0800

    :art: siyuan-note#8216

commit f8412a4
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:27:16 2023 +0800

    :bug: fix siyuan-note#8187

commit a74ee34
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:17:43 2023 +0800

    :art: fix siyuan-note#8242

commit 518ce94
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:09:11 2023 +0800

    :lipstick: bazaar

commit e6923bd
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 09:55:50 2023 +0800

    :art: https://github.com/siyuan-note/siyuan/issues/8245?utm_source=ld246.com
88250 pushed a commit that referenced this issue May 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
* 🎨 bazaar resource directories support symlink

* 🎨 bazaar resource directories support symlink

* Squashed commit of the following:

commit a335101
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 12:53:33 2023 +0800

    :bookmark: Release v2.8.8

commit 6a6dec0
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 11:30:33 2023 +0800

    :memo: Update changelogs

commit a819656
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 11:15:53 2023 +0800

    :memo: Update changelogs

commit 56a2c36
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 11:11:54 2023 +0800

    :bug: Remove inconsistent scroll IAL

commit 8b6abec
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 10:39:48 2023 +0800

    :art: Bazaar resource directories support symlink #8263

commit 9455086
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 10:35:46 2023 +0800

    :memo: Update changelogs

commit fdbfe6b
Author: 颖逸 <49649786+Zuoqiu-Yingyi@users.noreply.github.com>
Date:   Tue May 16 10:34:38 2023 +0800

    Bazaar resource directories support symlink (#8263)

    * 🎨 bazaar resource directories support symlink

    * 🎨 bazaar resource directories support symlink

commit 8549634
Author: Vanessa <lly219@gmail.com>
Date:   Tue May 16 10:31:01 2023 +0800

    :sparkles: enable plugin

commit f3d1acd
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 09:39:01 2023 +0800

    :memo: Update changelogs

commit bf4b88a
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 09:38:50 2023 +0800

    :art: Plugin hot load

commit 516276d
Author: Liang Ding <d@b3log.org>
Date:   Tue May 16 09:09:31 2023 +0800

    :art: Data sync connectivity check supports redirection Fix #8264

commit d24f5ae
Author: Vanessa <lly219@gmail.com>
Date:   Tue May 16 00:05:18 2023 +0800

    :rotating_light:

commit 1ac623e
Author: Vanessa <lly219@gmail.com>
Date:   Tue May 16 00:04:25 2023 +0800

    :art: fix #8258

commit fdf9f0d
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 22:33:36 2023 +0800

    :art: #5066 removeData

commit 7c7f3db
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 22:26:11 2023 +0800

    :bug: fix #8259

commit ba4e5e8
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 19:59:13 2023 +0800

    :lipstick: fix #8260

commit 4f099bd
Merge: b892fad 856c7e0
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 19:35:33 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit b892fad
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 19:35:19 2023 +0800

    :lipstick:

commit 856c7e0
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 18:48:33 2023 +0800

    :memo: Improve initialization data sync interaction #8220

commit ab6cb33
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 18:41:51 2023 +0800

    :memo: Improve initialization data sync interaction #8220

commit a759936
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 16:02:58 2023 +0800

    :memo: Improve initialization data sync interaction #8220

commit 2513cbc
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 15:53:46 2023 +0800

    :memo: Improve initialization data sync interaction #8220

commit 9a03f1e
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 15:52:00 2023 +0800

    :memo: Update changelogs

commit 4cb9523
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 15:51:31 2023 +0800

    :art: #8220

commit 7d58ab0
Merge: 6ca6817 0a10285
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 15:43:33 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit 6ca6817
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 15:43:16 2023 +0800

    :art: #8220

commit 0a10285
Author: Liang Ding <d@b3log.org>
Date:   Mon May 15 14:56:12 2023 +0800

    :art: Escape the notification message #7811

commit 7dbfa43
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 13:59:50 2023 +0800

    :art: #8220

commit 15141dd
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 13:54:30 2023 +0800

    :art: #8220

commit dc1941d
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 12:11:45 2023 +0800

    :art: catch plugin load

commit e728818
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 12:04:22 2023 +0800

    :art: catch plugin load

commit 6690084
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 11:46:51 2023 +0800

    :art: fix #8256

commit 53a95ff
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 00:27:27 2023 +0800

    :lipstick: account

commit 4c7fe24
Merge: 3674e83 2cf8a81
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 00:11:08 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit 3674e83
Author: Vanessa <lly219@gmail.com>
Date:   Mon May 15 00:10:46 2023 +0800

    :lipstick: account

commit 2cf8a81
Author: Liang Ding <d@b3log.org>
Date:   Sun May 14 23:21:32 2023 +0800

    :art: Improve images render in the marketplace package siyuan-note/bazaar#1119

commit 7572db4
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 12:10:47 2023 +0800

    :art: fix #8216

commit 1807163
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 12:09:52 2023 +0800

    :art: fix #8216

commit 300a60a
Merge: 0b00159 a6ecb98
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 11:50:55 2023 +0800

    Merge remote-tracking branch 'origin/dev' into dev

commit 0b00159
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 11:50:41 2023 +0800

    :bug: open new window

commit a6ecb98
Author: Liang Ding <d@b3log.org>
Date:   Sun May 14 11:43:54 2023 +0800

    :art: Sponsorship through the Open Collective is no longer supported

commit 6c3c8d4
Author: Liang Ding <d@b3log.org>
Date:   Sun May 14 10:44:39 2023 +0800

    :art: When multiple windows exist, each window should be isolated using the `Optimize Typesetting` #8216

commit 3edd823
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:34:48 2023 +0800

    :art: #8216

commit f8412a4
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:27:16 2023 +0800

    :bug: fix #8187

commit a74ee34
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:17:43 2023 +0800

    :art: fix #8242

commit 518ce94
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 10:09:11 2023 +0800

    :lipstick: bazaar

commit e6923bd
Author: Vanessa <lly219@gmail.com>
Date:   Sun May 14 09:55:50 2023 +0800

    :art: https://github.com/siyuan-note/siyuan/issues/8245?utm_source=ld246.com

* 🎨 widgets search support symlink directory

* 🎨 templates directory support symlink

* Update template.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants