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

是否需要提供一个 unmount 的 API,在微前端场景,需要卸载数据 #12

Open
brickspert opened this issue Dec 9, 2019 · 3 comments

Comments

@brickspert
Copy link
Member

No description provided.

@X-neuron
Copy link

不需要,卸载数据..应当是组件自身的事
不应当是全局性的。
qiankun2.0 + hook 的 unmount的周期Hook函数,能自发解决卸载数据的逻辑。。

@awmleer awmleer mentioned this issue Jun 8, 2020
@wjkang
Copy link

wjkang commented Jul 7, 2020

如果能提供的话挺好,目前有这么个场景:我为每个页面(路由对应的顶层组件)创建了一个model,把页面下的组件的state 都聚合到这个model里,现在切换路由之后,hox 里通过下面代码(1.0.2之前的)创建的变量会一直存在,相应的 react 节点也没有unmount

const element = document.createElement("div");
  const container = new Container(hook);
  ReactDOM.render(
    <Executor
      onUpdate={val => {
        container.data = val;
        container.notify();
      }}
      hook={hook}
    />,
    element
  );

影响虽然不是很大,就是感觉有点别扭,可能我有点强迫症吧。。。

其实就是需要一个可以支持创建局部model的功能,路由切换,组件unmount的时候,model 也能自动unmount

@awmleer
Copy link
Member

awmleer commented Jul 7, 2020

@wjkang 可以关注下 v2 的 RFC(#37) 哈,应该会满足你的需求

@awmleer awmleer mentioned this issue May 19, 2022
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

No branches or pull requests

4 participants