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
enhance: auto layout hasSider #45361
Conversation
Run & review this pull request in StackBlitz Codeflow. |
|
||
const childNodes = toArray(children); | ||
|
||
return childNodes.some((node) => node.type === Sider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type 不是应该是字符串吗?Slider 应该是一个组件吧,这个能相等吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type 是 ReactComponent 类型,包含字符串和方法和特殊 obj
size-limit report 📦
|
要更新一下快照 |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #45361 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 692 694 +2
Lines 11667 11674 +7
Branches 3116 3117 +1
=========================================
+ Hits 11667 11674 +7
☔ View full report in Codecov by Sentry. |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
resolves #44518 #42576
💡 Background and solution
遍历子节点添加
hasSider
,不是最优解,比如对 HOC 无效。不过这个应该也能解90% 的 SSR 问题了。📝 Changelog
hasSider
check to avoid blink in SSR.hasSider
以防止在 SSR 场景下的闪烁问题。☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 1cf0df7
The pull request refactors the Layout and Sider components to use React hooks and a separate context file. It also improves the test coverage and the import order for the components. The main files affected are
layout.tsx
,Sider.tsx
,context.ts
,useHasSider.ts
, andindex.test.tsx
.🔍 Walkthrough
🤖 Generated by Copilot at 1cf0df7
LayoutContext
and its interface fromlayout.tsx
to a new filecontext.ts
for better modularity and reusability (link, link, link).