Replies: 1 comment
-
感谢 @ferreroxc 对此问题的认真讨论❤️ 如您所言,两个方法都能解决问题。个人偏向第二种,没有公告就是 代价是会影响代码逻辑的影响,这个影响也许不会很大,原因是绝大大部分的判断我都是用 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
描述bug
简单说明bug的现象、相关的错误提示、日志等
/themes/matery/components/Announcement.js
,当notice为空时,应当返回<></>,也就是不显示公告栏https://github.com/tangly1024/NotionNext/blob/2e7aa0b21e62cd2ae80a175f13ef7f29a191d0d4/themes/matery/components/Announcement.js#LL6C1-L10C4
复现步骤
出现这个bug的操作步骤
yarn dev
,去localhost:3000
查看网页期望的正常结果
希望按这个步骤,正常操作结果是什么
截图

相关的页面,应该的结果
环境
补充说明
与问题相关的其它说明
问题分析
notice是{}
在这段代码里
但如果
为什么notice是{}而不是null
在
lib/notion/getNotionData.js
中的deepClone
把null变成了{}NotionNext/lib/notion/getNotionData.js
Line 28 in 6357aa8
NotionNext/lib/utils.js
Line 89 in 6357aa8
解决思路
/themes/matery/components/Announcement.js
里面把if(!notice)
改成判断object为空的方法deepClone
里面把newObj = Array.isArray(obj) ? [] : {}
改成newObj = Array.isArray(obj) ? [] : null
,但不知道这样会不会影响到其他代码逻辑期待大家评论哪个解决方法更好,请 @tangly1024 把这个issue assign给我吧诶嘿
Beta Was this translation helpful? Give feedback.
All reactions