fix(site): mermaid 跳转后不渲染 — onAfterRouteChange 改订阅器#93
Merged
Conversation
ReadingProgress 与 mermaid 各自直接赋值 router.onAfterRouteChange (单值属性,非事件订阅),后挂载的 ReadingProgress 覆盖了 mermaid 的 回调,导致 SPA 跳转进含 mermaid 的页面时图不渲染、需 F5(首屏走 onMounted 不受影响,所以现象是"直接访问 URL 正常、跳转不显示、 F5 又正常")。 新增 router-hooks.ts 提供 subscribeAfterRouteChange 订阅器(订阅者 集合 + 单 dispatcher,带 try/catch 隔离),mermaid-client 与 ReadingProgress 改用之。治本:未来再加路由切换逻辑不会再互覆盖。 自查:grep 确认全局仅 router-hooks.ts 一处 onAfterRouteChange 赋值; vitepress dev 启动零 error;并行 build SUCCESS (34 task 全建)。 pre-commit update-translation-coverage hook 同步刷新了 README 翻译 覆盖率报告,一并纳入。
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.
基于跳转的mermaid图搞炸了,修复一下