Skip to content

Commit 3688a9f

Browse files
committed
Fix for Configure alerts form action path
1 parent 6119da1 commit 3688a9f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

apps/webapp/app/components/errors/ConfigureErrorAlerts.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export const ErrorAlertsFormSchema = z.object({
4646

4747
type ConfigureErrorAlertsProps = ErrorAlertChannelData & {
4848
connectToSlackHref?: string;
49+
formAction: string;
4950
};
5051

5152
export function ConfigureErrorAlerts({
@@ -55,6 +56,7 @@ export function ConfigureErrorAlerts({
5556
slack,
5657
emailAlertsEnabled,
5758
connectToSlackHref,
59+
formAction,
5860
}: ConfigureErrorAlertsProps) {
5961
const fetcher = useFetcher<{ ok?: boolean }>();
6062
const navigate = useNavigate();
@@ -125,7 +127,7 @@ export function ConfigureErrorAlerts({
125127
</div>
126128

127129
<div className="flex-1 overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
128-
<fetcher.Form method="post" {...form.props}>
130+
<fetcher.Form method="post" action={formAction} {...form.props}>
129131
<Fieldset className="flex flex-col gap-3 p-4">
130132
<div className="flex flex-col">
131133
<Paragraph variant="small/dimmed">You'll receive alerts when</Paragraph>

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors/route.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import { findProjectBySlug } from "~/models/project.server";
1818
import { findEnvironmentBySlug } from "~/models/runtimeEnvironment.server";
1919
import { requireUserId } from "~/services/session.server";
2020
import { env } from "~/env.server";
21-
import { EnvironmentParamSchema, v3ErrorsConnectToSlackPath } from "~/utils/pathBuilder";
21+
import {
22+
EnvironmentParamSchema,
23+
v3ErrorsConnectToSlackPath,
24+
v3ErrorsPath,
25+
} from "~/utils/pathBuilder";
2226
import {
2327
type CreateAlertChannelOptions,
2428
CreateAlertChannelService,
@@ -46,12 +50,15 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
4650
slug: envParam,
4751
});
4852

53+
const errorsPath = v3ErrorsPath({ slug: organizationSlug }, project, { slug: envParam });
54+
4955
return typedjson({
5056
alertData,
5157
projectRef: project.externalRef,
5258
projectId: project.id,
5359
environmentType: environment.type,
5460
connectToSlackHref,
61+
errorsPath,
5562
});
5663
};
5764

@@ -162,7 +169,7 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
162169
};
163170

164171
export default function Page() {
165-
const { alertData, connectToSlackHref } = useTypedLoaderData<typeof loader>();
172+
const { alertData, connectToSlackHref, errorsPath } = useTypedLoaderData<typeof loader>();
166173
const { has } = useSearchParams();
167174
const showAlerts = has("alerts") ?? false;
168175

@@ -176,7 +183,11 @@ export default function Page() {
176183
<>
177184
<ResizableHandle id="errors-alerts-handle" />
178185
<ResizablePanel id="errors-alerts" min="320px" default="420px" max="560px">
179-
<ConfigureErrorAlerts {...alertData} connectToSlackHref={connectToSlackHref} />
186+
<ConfigureErrorAlerts
187+
{...alertData}
188+
connectToSlackHref={connectToSlackHref}
189+
formAction={errorsPath}
190+
/>
180191
</ResizablePanel>
181192
</>
182193
)}

0 commit comments

Comments
 (0)