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

CacheSwitch不会触发Suspense的fallback #165

Open
langjinjie opened this issue Sep 26, 2023 · 3 comments
Open

CacheSwitch不会触发Suspense的fallback #165

langjinjie opened this issue Sep 26, 2023 · 3 comments

Comments

@langjinjie
Copy link

langjinjie commented Sep 26, 2023

大佬,使用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
Copy link
Owner

CJY0208 commented Oct 7, 2023

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

@langjinjie
Copy link
Author

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

@MrRainbowYoo
Copy link

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

请问解决这个问题了吗

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

3 participants