-
Notifications
You must be signed in to change notification settings - Fork 238
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(qiankun): 尝试修复嵌入主应用的子应用的热更新问题 #629
Open
fxxjdedd
wants to merge
8
commits into
umijs:master
Choose a base branch
from
fxxjdedd:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
当前问题在于, 在 [umijs#418](umijs#418) 中, 将clientRenderOpts改为clientRenderOptsStack, 并以pop的方式获取, 这样有两个问题: 1. 当热更新时, 由于已经pop过, 此时clientRenderOptsStack为空, 那么src中生成的`.umi/umi.ts`的modifyClientRenderOpts操作将无法修改rootElement为dom, 而是保持为string. 这就导致热更新时, 直接把子应用挂载到了string类型的rootElement对应的dom上, 也就是最外层的那个root, 就相当于子应用把主应用覆盖了. 2. 在 [umijs#423](umijs#423) 讲到, mount顺序是一定的, 但是render不是. 又因为上述pop过程是在render过程中进行的, 那么这个pop的顺序也不一定是安全的. 这里使用appId的方式来保证render和clientRenderOpts的一致性.
需要配合 umijs/umi#6702, 必须先等这个合并。 |
4 tasks
如果umijs没有升级到这次提交[#6702](umijs/umi#6702), 则使用原来的处理方式
related issues: |
当前pr还在进行中,过程如下:
|
Closed
4 tasks
fxxjdedd
changed the title
fix(qiankun): 尝试修复嵌入主应用的子应用的热更新问题
WIP: fix(qiankun): 尝试修复嵌入主应用的子应用的热更新问题
Jun 8, 2021
…OptsMap[appId]` is undefined
应该没什么要改的了 @kuitos 能帮忙审查一下吗? |
fxxjdedd
changed the title
WIP: fix(qiankun): 尝试修复嵌入主应用的子应用的热更新问题
fix(qiankun): 尝试修复嵌入主应用的子应用的热更新问题
Jun 9, 2021
fixed umijs/umi#6521 |
请问更新了吗 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
当前问题在于, 在 #418 中, 将clientRenderOpts改为clientRenderOptsStack, 并以pop的方式获取, 这样有两个问题:
当热更新时, 由于已经pop过, 此时clientRenderOptsStack为空, 那么src中生成的
.umi/umi.ts
的modifyClientRenderOpts操作将无法修改rootElement为dom, 而是保持为string.这就导致热更新时, 直接把子应用挂载到了string类型的rootElement对应的dom上, 也就是最外层的那个root, 就相当于子应用把主应用覆盖了.
在 #423 讲到, mount顺序是一定的, 但是render不是. 又因为上述pop过程是在render过程中进行的, 那么这个pop的顺序也不一定是安全的.
这里使用appId的方式来保证render和clientRenderOpts的一致性.