CJY0208 / react-router-cache-route

Route with cache for react-router V5 like <keep-alive /> in Vue
https://www.npmjs.com/package/react-router-cache-route
MIT License
1.16k stars 113 forks source link

CacheSwitch不会触发Suspense的fallback #165

Open langjinjie opened 1 year ago

langjinjie commented 1 year ago

大佬,使用CacheSwitch包住路由不能触发Suspense的fallback

<Suspense fallback={<Loading />}>
    <CacheSwitch>
      {routes.map(({ path, ...props }: RouteProps) => (
        <Route key={`rt${path}`} path={path} {...props} exact />
      ))}
      {cacheRoutes.map(({ path, ...props }: CacheRouteProps) => (
        <CacheRoute className="cache-route" key={`rt${path}`} path={path} {...props} exact />
      ))}
      <Redirect from="/*" to="/error" />
    </CacheSwitch>
  </Suspense>
CJY0208 commented 1 year ago

有用到 React.lazy 吗,suspense 需要配合这个 api 使用

langjinjie commented 1 year ago

有用到的,用react-router-dom就能正常触发。

MrRainbowYoo commented 8 months ago

有用到的,用react-router-dom就能正常触发。

请问解决这个问题了吗