Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export useMatchedRoute hook for theme #2165

Merged
merged 4 commits into from
Jul 26, 2024

Conversation

Wxh16144
Copy link
Member

@Wxh16144 Wxh16144 commented Jul 10, 2024

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

  • 新特性提交 / New feature
  • bug 修复 / Fix bug
  • 样式优化 / Style optimization
  • 代码风格优化 / Code style optimization
  • 性能优化 / Performance optimization
  • 构建优化 / Build optimization
  • 网站、文档、Demo 改进 / Website, documentation, demo improvements
  • 重构代码或样式 / Refactor code or style
  • 测试相关 / Test related
  • 其他 / Other

🔗 相关 Issue / Related Issue

fix: #2124

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

#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

Copy link

vercel bot commented Jul 10, 2024

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

Wxh16144 added a commit to Wxh16144-forks/dumi-theme-antd-style that referenced this pull request Jul 10, 2024
@@ -156,6 +156,28 @@ const Example = () => {
};
```

### useMatchRoute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

叫 useMatchedRoute 更好点?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哈哈哈 我一开始也叫这个名字的,感觉太长了点

@PeachScript PeachScript changed the title feat: export useMatchRoute feature hooks feat: export useMatchedRoute hook from theme api Jul 12, 2024
@PeachScript PeachScript changed the title feat: export useMatchedRoute hook from theme api feat: export useMatchedRoute hook for theme Jul 12, 2024
@PeachScript PeachScript merged commit 0d1dc35 into umijs:master Jul 26, 2024
9 checks passed
arvinxx pushed a commit to arvinxx/dumi-theme-antd-style that referenced this pull request Aug 6, 2024
* 🐛 fix: 修复页面白屏错误

* chore: fix lint

* chore: update

* chore: 更新说明

* chore: update

wait: umijs/dumi#2165

* chore: update peerdeps

* chore: re-import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants