hunk.code_window: FROM node:16-alpine as builder
   WORKDIR /app
   RUN apk add g++ make python3 git libpng-dev && npm i -g pnpm@7
   COPY . .
   RUN pnpm i --frozen-lockfile --store=node_modules/.pnpm-store && pnpm run build:venus
   FROM node:16-alpine as relocate
   WORKDIR /app
   COPY --from=builder /app/dist/apps/venus ./dist
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.after_edit: RUN --mount=type=cache,target=/app/node_modules,rw,sharing=private pnpm i  --frozen-lockfile --store=node_modules/.pnpm-store && pnpm run build:venus
  
hunk.file_path: .github/deployment/Dockerfile-venus
hunk.type: replace
file: import { Navigate, useLocation } from 'react-router-dom';
  
  import { PageLoading } from '@toeverything/components/account';
  import { useUserAndSpaces } from '@toeverything/datasource/state';
  
  export type RouteUnauthorizedOnlyProps = {
      children: JSX.Element;
  };
  
  /**
   * Routing components that are accessible without logging in and inaccessible after logging in will automatically jump to the specified route authorizedRedirectTo
   */
  export function RoutePublicAutoLogin({ children }: RouteUnauthorizedOnlyProps) {
      const { pathname } = useLocation();
  
      const { user, loading, currentSpaceId } = useUserAndSpaces();
  
      if (user == null && loading) {
          return <PageLoading />;
      }
  
      if (currentSpaceId) {
          return (
              <Navigate
                  to={`/${currentSpaceId}`}
                  state={{ from: pathname }}
                  replace={true}
              />
          );
      }
  
      return children;
  }
  