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: runtime plugin support modifyClientRenderOpts #5096

Merged
merged 3 commits into from
Jul 24, 2020

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented Jul 24, 2020

Checklist
  • npm test passes
  • tests are included
  • documentation is changed or added
  • commit message follows commit guidelines
Description of change

支持修改 clientRender 参数。

比如:

export function modifyClientRenderOpts(memo) {
  return {
    ...memo,
    foo: 'bar',    
  };
}

Close #5067
Ref #4979
Close #5020


View rendered docs/docs/runtime-config.md
View rendered docs/docs/runtime-config.zh-CN.md

@sorrycc sorrycc requested review from ycjcl868 and kuitos and removed request for ycjcl868 July 24, 2020 09:10
@codecov
Copy link

codecov bot commented Jul 24, 2020

Codecov Report

Merging #5096 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5096   +/-   ##
=======================================
  Coverage   82.84%   82.84%           
=======================================
  Files         153      153           
  Lines        3381     3381           
  Branches      906      908    +2     
=======================================
  Hits         2801     2801           
+ Misses        573      572    -1     
- Partials        7        8    +1     
Impacted Files Coverage Δ
packages/core/src/Config/Config.ts 61.78% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b954eb6...fcca808. Read the comment docs.

@@ -8,6 +8,21 @@

## 配置项

### modifyClientRenderOpts(fn)

修改 clientRender 参数。
Copy link
Contributor

Choose a reason for hiding this comment

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

文档里解释一下能做什么?感觉看不太懂。

Copy link
Member Author

Choose a reason for hiding this comment

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

我补一个,其实很少会用到,只在微前端里有。

@kuitos
Copy link
Member

kuitos commented Jul 24, 2020

#4979 这个 issue 是关掉重新提还是改下?调用 ReactDOM.render 时读取 callback 的变更还是需要的 @ycjcl868

export function modifyClientRenderOpts(memo) {
return {
...memo,
mountElementId: isSubApp ? 'sub-root' : memo.mountElementId,
Copy link
Member

Choose a reason for hiding this comment

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

看下面的代码用法不是传递 mountElementId 而是传递 rootElement

Copy link
Member Author

Choose a reason for hiding this comment

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

是的,rootElement。

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.

[RFC] 支持运行时修改 mountElementId
4 participants