umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.61k stars 1.18k forks source link

feat: export useMatchedRoute hook for theme #2165

Closed Wxh16144 closed 3 months ago

Wxh16144 commented 4 months ago

🤔 这个变动的性质是?/ What is the nature of this change?

🔗 相关 Issue / Related Issue

fix: #2124

💡 需求背景和解决方案 / Background or solution

https://github.com/umijs/dumi/pull/1974 中对 useRouteMeta 返回结果进行了 Proxy , 并且在获取 texts 时抛出了一个 Promise

dumi-theme-antd-style 主题包在 https://github.com/arvinxx/dumi-theme-antd-style/blob/7d6977a374a21be7399492522439e8005a7f7fda/src/components/StoreUpdater/index.tsx#L74 处引用了,导致页面一直卡白屏(未处理 Promise).

主题侧准备 用 SWR 自定义获取 RouterMeta 但是需要获取当前 router.id 并通过 dumi 的 getRouteMetaById 方法获取 meta 信息。

将逻辑提取为 useMatchedRoute 并对外暴露出来。

📝 更新日志 / Changelog

Language Changelog
🇺🇸 English export useMatchedRoute feature hooks
🇨🇳 Chinese 导出useMatchedRoute hooks
vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dumi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 2:24am