Closed
Description
3.1.26版本开始,插件触发重载会导致插件style样式丢失
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
参考 HowcanoeWang/siyuan-plugin-background-cover#29 (comment)
目前为止貌似只有我这个插件出问题了,别人的插件暂时还没听到有类似的bug(有可能是我这个插件纯样式为主比较容易被发现?)
Expected result
确保插件样式在重载后不丢失?
Screenshot or screen recording presentation
No response
Version environment
- Version:
- Operating System:
- Browser (if used):
Log file
不适用
More information
相关链接:
https://ld246.com/article/1743071139289/comment/1743302100931#comments
https://ld246.com/article/1743071139289/comment/1744249227031#comments
https://ld246.com/article/1744338584487
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
HowcanoeWang commentedon Apr 11, 2025
正在尝试用新的工作空间来进行复现
HowcanoeWang commentedon Apr 11, 2025
需要准备两台电脑和一个思源账号,这个bug只有开云端同步时才会出现。
具体步骤:
电脑A:新建一个本地工作空间,手动添加几个笔记页面,登录思源账号,设置中打开思源同步,配置好云端同步目录,安装思源背景插件,上传至少两张(5张以上更方便复现)图片作为背景,然后同步。
电脑B:新建一个本地工作空间,登录思源账号,设置中打开思源同步,配置好云端同步目录,等待思源同步把A上面的数据全部同步好。
由于思源背景插件会将配置以json文件记录在
data\storage\petal\siyuan-plugin-background-cover\bg-cover-setting.json
文件内,而由于之前的设计失误,会将每台电脑当前的背景图片也写在这个json中,于是出现了这个情况:电脑A的
bg-cover-setting.json
文件和 电脑B的bg-cover-setting.json
,记录了不同的当前背景图片,导致数据出现冲突,然后会触发思源笔记的插件重载?然后在重载的过程中,会把背景插件的css样式整丢掉,这是此issue想要排查的重点问题。虽然主要矛盾还是配置文件同步冲突引起的,应该将每台电脑独立的属性写在localStorage而不是全局json进行同步,就可以避免触发同步冲突的问题,但同时这也是一个好机会,能排查为什么3.1.26版本后重载插件会导致css样式丢失,老版本不会丢。
HowcanoeWang commentedon Apr 11, 2025
刚刚临时修复了css丢失的问题,现在复现的话,需要用之前的插件安装包:https://github.com/HowcanoeWang/siyuan-plugin-background-cover/releases/tag/0.4.6
localStorage
#6960Vanessa219 commentedon Apr 13, 2025
是如何修复的?这边还需要处理么?
HowcanoeWang commentedon Apr 13, 2025
HowcanoeWang/siyuan-plugin-background-cover#29 (comment)
放弃引用css文件,直接把css用代码添加到元素style里,只是一个临时措施,还是希望能定位一下触发插件重载和css文件丢失的问题。
Vanessa219 commentedon Apr 13, 2025
重载指的是刷新界面么?多次刷新后插件的 css 都在的。
HowcanoeWang commentedon Apr 13, 2025
不是手动刷新页面。
试试某一台设备修改背景图,和另一台设备的背景图不一样后(要开启插件设置里的 启动时自动更换背景 选项),然后进行双端的云端同步。
这时候由于插件的json配置文件冲突,会触发思源自己的插件重载,思源log如下:
表现为console里,背景插件提示 插件载入成功和插件成功卸载
Vanessa219 commentedon Apr 15, 2025
同步不太好模拟,但是使用打开和关闭插件,也会有这样的日志。样式是存在的,只是位置挪动了一下,如下下图。
HowcanoeWang commentedon Apr 15, 2025
手动打开和关闭插件以及刷新都不会触发,插件的加载都没问题,
目前只有放着不动时,云端同步冲突触发的插件重载会有这个问题。
用思源3.1.26版本测试的
Vanessa219 commentedon Apr 15, 2025
@88250 看一下是否没有推送
IPluginData.css
6 remaining items