-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: skip bundle stats when load non-html page #12246
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
WalkthroughThe recent update in the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/preset-umi/src/features/devTool/devTool.ts (1 hunks)
Additional comments (1)
packages/preset-umi/src/features/devTool/devTool.ts (1)
- 83-97: The logic introduced to check the request headers'
Accept
value before deciding to serve the loading HTML is a good approach to address the issue described in the PR objectives. However, there are a few considerations and potential improvements:
Performance and Readability: The condition checks for
text/html
or*/*
in theAccept
header. This is a straightforward and effective way to determine the content type the client expects. However, it's worth noting that theAccept
header can contain multiple values with varying priorities. While the current implementation works for most cases, a more robust parsing might be needed for complex scenarios. For now, this approach is sufficient but keep an eye on edge cases where clients send complexAccept
headers.Maintainability: The logic for determining whether the bundle is done is clear and concise. It checks the bundle status and, depending on the configuration (
enableVite
,mfsu
), decides whether to serve the loading HTML. This is a good practice as it keeps the decision-making process centralized and easy to understand. However, consider extracting this logic into a separate function if the decision-making process becomes more complex in the future. This would improve maintainability and testability.Best Practices: Setting the
Content-Type
header explicitly before sending the response is a good practice, ensuring that the client interprets the response correctly. This aligns with best practices for web development.Overall, the changes are well-implemented and address the issue at hand effectively. Just keep the mentioned considerations in mind for future development.
这个改动经验证真的解决了你的问题了吗,See #12235 (comment) ,我认为有可能没完全解决。 |
close: #12235
Summary by CodeRabbit