diff --git a/packages/frontend/core/src/pages/index.tsx b/packages/frontend/core/src/pages/index.tsx index e8ee9ff064..5047947277 100644 --- a/packages/frontend/core/src/pages/index.tsx +++ b/packages/frontend/core/src/pages/index.tsx @@ -77,7 +77,6 @@ export const Component = () => { // check is user logged in && has cloud workspace if (searchParams.get('initCloud') === 'true') { if (loggedIn) { - searchParams.delete('initCloud'); if (list.every(w => w.flavour !== WorkspaceFlavour.AFFINE_CLOUD)) { createCloudWorkspace(); return; diff --git a/packages/frontend/core/src/router.tsx b/packages/frontend/core/src/router.tsx index fe7acb81d6..081694c868 100644 --- a/packages/frontend/core/src/router.tsx +++ b/packages/frontend/core/src/router.tsx @@ -4,6 +4,7 @@ import type { NavigateFunction, RouteObject } from 'react-router-dom'; import { createBrowserRouter as reactRouterCreateBrowserRouter, Outlet, + redirect, useLocation, // eslint-disable-next-line @typescript-eslint/no-restricted-imports useNavigate, @@ -104,6 +105,14 @@ export const topLevelRoutes = [ path: '/subscribe', lazy: () => import('./pages/subscribe'), }, + { + path: '/try-cloud', + loader: () => { + return redirect( + `/signIn?redirect_uri=${encodeURIComponent('/?initCloud=true')}` + ); + }, + }, { path: '*', lazy: () => import('./pages/404'),