Skip to content

Commit 680b42f

Browse files
committed
fix(webapp): hard-navigate after creating a project
1 parent c2c6e5c commit 680b42f

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

  • apps/webapp/app/routes/_app.orgs.$organizationSlug_.projects.new

apps/webapp/app/routes/_app.orgs.$organizationSlug_.projects.new/route.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import { getFormProps, getInputProps, useForm } from "@conform-to/react";
22
import { parseWithZod } from "@conform-to/zod";
33
import { CommandLineIcon, FolderIcon } from "@heroicons/react/20/solid";
4-
import { json, type ActionFunction, type LoaderFunctionArgs } from "@remix-run/node";
4+
import {
5+
json,
6+
redirectDocument,
7+
type ActionFunction,
8+
type LoaderFunctionArgs,
9+
} from "@remix-run/node";
510
import { Form, useActionData, useNavigation } from "@remix-run/react";
611
import type { Prisma } from "@trigger.dev/database";
712
import React, { useEffect, useState } from "react";
8-
import { redirect, typedjson, useTypedLoaderData } from "remix-typedjson";
13+
import { typedjson, useTypedLoaderData } from "remix-typedjson";
914
import invariant from "tiny-invariant";
1015
import { z } from "zod";
1116
import { BackgroundWrapper } from "~/components/BackgroundWrapper";
@@ -285,14 +290,17 @@ export const action: ActionFunction = async ({ request, params }) => {
285290
if (next) {
286291
params.set("next", next);
287292
}
288-
return redirect(`/vercel/connect?${params.toString()}`);
293+
return redirectDocument(`/vercel/connect?${params.toString()}`);
289294
}
290295

291-
return redirectWithSuccessMessage(
292-
v3ProjectPath(project.organization, project),
296+
const destination = v3ProjectPath(project.organization, project);
297+
const response = await redirectWithSuccessMessage(
298+
destination,
293299
request,
294300
`${submission.value.projectName} created`
295301
);
302+
303+
return redirectDocument(destination, { headers: response.headers });
296304
} catch (error) {
297305
if (error instanceof ExceededProjectLimitError) {
298306
return redirectWithErrorMessage(

0 commit comments

Comments
 (0)