Repository navigation
面板不再在加载时写死深浅色 - #41
Merged
Merged
Conversation
面板与公开主题同源,共用 theme 这个 key。面板此前在挂载的 effect 里无条件写盘,于是 访客只要点开一次后台(或在公开页关闭时被跳转过去),公开页的 theme 就被填上了当时的 系统配色,此后不再跟随系统——而两个主题都以「没写盘就跟随系统」为约定,这一条必须三个 app 一致。改为只有点击切换时才落盘。 系统配色改用 useSyncExternalStore 订阅:此前拷进 state,监听器要等 effect 才挂上,落在 首次渲染与挂载之间的那次切换没有人听见。 两个主题的同一处见 monitor-probe/monitor-theme-serverstatus#5 与 monitor-probe/monitor-theme-default#4。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
面板在挂载时无条件把系统配色写进
localStorage,把同源公开主题的「跟随系统」一并钉死。theme这个 key。访客点开一次后台(或在公开页关闭时被跳转过去),公开页的theme就被填上当时的系统配色,此后不再跟随系统。prefers-color-scheme。三个 app 必须一致,否则任何一个在加载时写盘都会把其余的钉死。useSyncExternalStore订阅:此前拷进 state,监听器要等 effect 才挂上,落在首次渲染与挂载之间的那次切换没有人听见。tsc -b、oxlint、npm test、npm run build通过。两个主题的同一处见 monitor-probe/monitor-theme-serverstatus#5 与 monitor-probe/monitor-theme-default#4。