umi icon indicating copy to clipboard operation
umi copied to clipboard

fix: fix use useSearchParams in useModel (#8545)

Open zhangpanweb opened this issue 3 years ago • 3 comments

Close #8545

由于 BrowserRoutes 作为 children 传给 dataflow plugin,在 useModel 使用 useSearchParams,会导致无法获取 router context。修复方式为,将 BrowserRoutes 放置在外层,使 dataflow 相关 plugin 中都能够获取到 router context,从而顺利使用 router 相关 hooks

zhangpanweb avatar Jul 17 '22 07:07 zhangpanweb

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

1 Ignored Deployment
Name Status Preview Updated
umi ⬜️ Ignored (Inspect) Jul 24, 2022 at 1:13PM (UTC)

vercel[bot] avatar Jul 17 '22 07:07 vercel[bot]

Codecov Report

Merging #8571 (dbb5651) into master (6dc8342) will decrease coverage by 0.00%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #8571      +/-   ##
==========================================
- Coverage   31.06%   31.06%   -0.01%     
==========================================
  Files         389      389              
  Lines       10419    10420       +1     
  Branches     2473     2473              
==========================================
  Hits         3237     3237              
- Misses       6731     6732       +1     
  Partials      451      451              
Impacted Files Coverage Δ
packages/renderer-react/src/browser.tsx 0.00% <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 6dc8342...dbb5651. Read the comment docs.

codecov[bot] avatar Jul 18 '22 09:07 codecov[bot]

rootContainer 的含义是不是要保留,比如我,我目前为了让其在 router context 中,是这样做的,

参考 plugin-model 实现了一个 plugin-executor,他的 runtime 是

export function innerProvider(container, opts) {
  return React.cloneElement(
    container,
    null,
    <ProviderWrapper {...opts}>{container.props.children}</ProviderWrapper>,
  );
}

tolerance-go avatar Sep 05 '22 14:09 tolerance-go