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

fix(preset-umi): wrong public path when preloading route chunks for qiankun app #12234

Merged
merged 2 commits into from Mar 28, 2024

Conversation

zkp442910864
Copy link
Contributor

@zkp442910864 zkp442910864 commented Mar 26, 2024

增加优先级 stage: 9999

Summary by CodeRabbit

  • Refactor
    • Updated the method for adding HTML head scripts to enhance customization and maintainability.

Copy link

vercel bot commented Mar 26, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
umi ⬜️ Ignored (Inspect) Visit Preview Mar 26, 2024 7:36am

Copy link

coderabbitai bot commented Mar 26, 2024

Walkthrough

The update modifies the way functions are passed to the addHTMLHeadScripts method within the routePreloadOnLoad.ts file, shifting from a direct function input to an object containing the function. This adjustment streamlines the handling and processing of the function, maintaining the core logic but enhancing the method's flexibility and clarity in handling script-related operations.

Changes

File Path Summary of Changes
.../routePreloadOnLoad/routePreloadOnLoad.ts Updated addHTMLHeadScripts method to accept an object with a fn property instead of a function.

🐰✨
Changes abound, the code does leap,
Through the digital meadow, so wide, so deep.
With a hop and a skip, the scripts align,
In objects they nest, by design so fine.
Oh, how the code flows, under moon and sun,
A rabbit's work, it's never done.
🌟🐾

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 2c43662 and 2d3e792.
Files selected for processing (1)
  • packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts (1 hunks)
Additional comments: 1
packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts (1)
  • 222-262: The change to the addHTMLHeadScripts method to accept an object with a fn property instead of a direct function is a significant alteration. This approach enhances flexibility and allows for additional properties to be passed in the future if needed. However, ensure that all calls to addHTMLHeadScripts throughout the codebase have been updated to match the new signature to avoid runtime errors.

Additionally, setting the stage to 9999 significantly increases the execution priority of the plugin's operations. While this ensures that the plugin's actions take precedence over others, it's crucial to document the rationale behind such a high priority value to aid future maintainability and understanding of the codebase.

Consider adding comments explaining the choice of 9999 for the stage value, including any potential impacts this might have on the execution order of other plugins or operations.

…adOnLoad.ts

Co-authored-by: Peach <scdzwyxst@gmail.com>
Copy link

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 2d3e792 and 98c1dcb.
Files selected for processing (1)
  • packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/preset-umi/src/features/routePreloadOnLoad/routePreloadOnLoad.ts

@PeachScript PeachScript changed the title fix:修改 routePreloadOnLoad.ts 插件,插入代码的优先级 fix(preset-umi): wrong public path when preload route chunks for qiankun app Mar 26, 2024
@PeachScript PeachScript changed the title fix(preset-umi): wrong public path when preload route chunks for qiankun app fix(preset-umi): wrong public path when preloading route chunks for qiankun app Mar 26, 2024
Copy link
Member

@PeachScript PeachScript left a comment

Choose a reason for hiding this comment

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

+1

@fz6m fz6m linked an issue Mar 27, 2024 that may be closed by this pull request
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 28.41%. Comparing base (2c43662) to head (98c1dcb).

Files Patch % Lines
.../features/routePreloadOnLoad/routePreloadOnLoad.ts 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12234      +/-   ##
==========================================
- Coverage   28.41%   28.41%   -0.01%     
==========================================
  Files         492      492              
  Lines       15166    15167       +1     
  Branches     3626     3626              
==========================================
  Hits         4310     4310              
- Misses      10084    10085       +1     
  Partials      772      772              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PeachScript PeachScript merged commit 3de4a38 into umijs:master Mar 28, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] route chunk preload 微前端加载失败问题
2 participants