Skip to content

CacheSwitch不会触发Suspense的fallback #165

Open

Description

@langjinjie

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

Activity

  1. CJY0208 commented on Oct 7, 2023

    @CJY0208
    Owner

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

  2. langjinjie commented on Oct 20, 2023

    @langjinjie
    Author

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

  3. MrRainbowYoo commented on Feb 20, 2024

    @MrRainbowYoo

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

    请问解决这个问题了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions