HelloGitHub-Team / geese

采用 Next.js 构建的开源爱好者社区。An open-source enthusiast community built with Next.js.
https://hellogithub.com
Apache License 2.0
282 stars 66 forks source link

suggesions #113

Closed Maidang1 closed 1 year ago

Maidang1 commented 1 year ago

我看到 readme 中有一个 bug 「PC 端在暗黑模式下打开项目详情页会闪一下」,看了一下代码,现在好像是将主题存到了 localStorage 里面,我理解可以存到 cookie 里面 next.js 在 SSR 的时候应该可以读取到 cookie 然后直接在 _document.tsx 直接修改 html 的 class = "dark" | "light", 这样当前是不是 dark mode 就可以在吐出到浏览器之前就确认了,我感觉可以解决闪一下的问题