qiankun
qiankun copied to clipboard
官方demo 子应用调同级子应用, 刷新后无法加载
What happens?
在子应用react15调用react16,刷新后加载不了子应用react16
A clear and concise description of what the bug is.
Mini Showcase Repository(REQUIRED)
https://www.awesomescreenshot.com/video/16254763?key=8a834c06331b63e1c856c7f015d1577a
Provide a mini GitHub repository which can reproduce the issue.
官方master分支,在qiankun/examples/react15/components/HelloModal.jsx修改下面代码,用loadMicroApp加载react16子应用,如下:
export default class HelloModal extends React.Component {
constructor() {
super();
this.state = {
visible: false,
};
this.setVisible = visible => this.setState({ visible });
this.microApp = null;
}
componentDidMount() {
this.microApp = loadMicroApp({ name: 'react16', entry: '//localhost:7100', container: '#aa' },
{ singular: true, sandbox: { experimentalStyleIsolation: true } });
}
componentWillUnmount() {
this.microApp.unmount();
}
render() {
const { visible } = this.state;
return (
<div>
<Button onClick={() => this.setVisible(true)}>
CLICK ME 15
</Button>
<div ref={(ref) => { this.containerRef = ref }} id="aa"></div>
<Modal
visible={visible}
closable={false}
onOk={() => this.setVisible(false)}
onCancel={() => this.setVisible(false)}
title="Install"
>
<code>$ yarn add qiankun # or npm i qiankun -S</code>
</Modal>
</div>
);
}
}
How To Reproduce
首次可以加载,刷新后就报错。 去掉setDefaultMountApp('/react16'),刷新后就正常,react15里面可加载react16子应用
Steps to reproduce the behavior: 1. 2.
Expected behavior 1. 2.
Context
- qiankun Version: "version": "2.10.5",
- Platform Version:
- Browser Version: chrome macOS 10.12
解决了吗
解决了吗?