Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: don't use confirmation modal on login forms

Brad Barbin5ffa2be2b57b
diff --git a/apps/carbon/app/modules/account/ui/Password/PasswordForm.tsx b/apps/carbon/app/modules/account/ui/Password/PasswordForm.tsx
index 8c5755d43a..387ad2ade6 100644
--- a/apps/carbon/app/modules/account/ui/Password/PasswordForm.tsx
+++ b/apps/carbon/app/modules/account/ui/Password/PasswordForm.tsx
@@ -55,7 +55,9 @@ const PasswordForm = () => {
</VStack>
</CardContent>
<CardFooter>
- <Submit isDisabled={!passwordsMatch}>Update Password</Submit>
+ <Submit isDisabled={!passwordsMatch} withBlocker={false}>
+ Update Password
+ </Submit>
</CardFooter>
</ValidatedForm>
</Card>
diff --git a/apps/carbon/app/routes/_public+/forgot-password.tsx b/apps/carbon/app/routes/_public+/forgot-password.tsx
index 4bd7873473..32ac289666 100644
--- a/apps/carbon/app/routes/_public+/forgot-password.tsx
+++ b/apps/carbon/app/routes/_public+/forgot-password.tsx
@@ -118,7 +118,7 @@ export default function ForgotPasswordRoute() {
</Alert>
)}
<Input name="email" label="Email" />
- <Submit size="lg" className="w-full">
+ <Submit size="lg" className="w-full" withBlocker={false}>
Reset Password
</Submit>
<Button variant="link" asChild className="w-full">
diff --git a/apps/carbon/app/routes/_public+/login.tsx b/apps/carbon/app/routes/_public+/login.tsx
index 944721ca0f..4bd4119318 100644
--- a/apps/carbon/app/routes/_public+/login.tsx
+++ b/apps/carbon/app/routes/_public+/login.tsx
@@ -113,7 +113,12 @@ export default function LoginRoute() {
<Input name="email" label="Email" />
<Password name="password" label="Password" type="password" />
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
- <Submit size="lg" className="w-full" onClick={handleClick}>
+ <Submit
+ size="lg"
+ className="w-full"
+ onClick={handleClick}
+ withBlocker={false}
+ >
Sign In
</Submit>
<Button variant="link" asChild className="w-full">
diff --git a/apps/carbon/app/routes/_public+/reset-password.tsx b/apps/carbon/app/routes/_public+/reset-password.tsx
index d550e41377..2c2b5f0303 100644
--- a/apps/carbon/app/routes/_public+/reset-password.tsx
+++ b/apps/carbon/app/routes/_public+/reset-password.tsx
@@ -80,7 +80,7 @@ export default function ResetPasswordRoute() {
<Password name="password" label="New Password" />
<HStack spacing={4}>
- <Submit>Reset Password</Submit>
+ <Submit withBlocker={false}>Reset Password</Submit>
<Button
variant="secondary"
onClick={() => navigate(path.to.authenticatedRoot)}
diff --git a/apps/developers/app/routes/_public+/forgot-password.tsx b/apps/developers/app/routes/_public+/forgot-password.tsx
index ead1092413..bfa7d4abc5 100644
--- a/apps/developers/app/routes/_public+/forgot-password.tsx
+++ b/apps/developers/app/routes/_public+/forgot-password.tsx
@@ -120,7 +120,7 @@ export default function ForgotPasswordRoute() {
</Alert>
)}
<Input name="email" label="Email" />
- <Submit size="lg" className="w-full">
+ <Submit size="lg" className="w-full" withBlocker={false}>
Reset Password
</Submit>
<Button variant="link" asChild className="w-full">
diff --git a/apps/developers/app/routes/_public+/login.tsx b/apps/developers/app/routes/_public+/login.tsx
index 2672742cb5..c8bbeb778f 100644
--- a/apps/developers/app/routes/_public+/login.tsx
+++ b/apps/developers/app/routes/_public+/login.tsx
@@ -123,7 +123,12 @@ export default function LoginRoute() {
<Input name="email" label="Email" />
<Password name="password" label="Password" type="password" />
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
- <Submit size="lg" className="w-full" onClick={handleClick}>
+ <Submit
+ size="lg"
+ className="w-full"
+ onClick={handleClick}
+ withBlocker={false}
+ >
Sign In
</Submit>
<Button variant="link" asChild className="w-full">
diff --git a/apps/mes/app/routes/_public+/forgot-password.tsx b/apps/mes/app/routes/_public+/forgot-password.tsx
index ca500ef624..2f8748b9c0 100644
--- a/apps/mes/app/routes/_public+/forgot-password.tsx
+++ b/apps/mes/app/routes/_public+/forgot-password.tsx
@@ -113,7 +113,7 @@ export default function ForgotPasswordRoute() {
</Alert>
)}
<Input name="email" label="Email" />
- <Submit size="lg" className="w-full">
+ <Submit size="lg" className="w-full" withBlocker={false}>
Reset Password
</Submit>
<Button variant="link" asChild className="w-full">
diff --git a/apps/mes/app/routes/_public+/login.tsx b/apps/mes/app/routes/_public+/login.tsx
index 6b079836df..4e1675640a 100644
--- a/apps/mes/app/routes/_public+/login.tsx
+++ b/apps/mes/app/routes/_public+/login.tsx
@@ -120,7 +120,12 @@ export default function LoginRoute() {
<Input name="email" label="Email" />
<Password name="password" label="Password" type="password" />
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
- <Submit size="lg" className="w-full" onClick={handleClick}>
+ <Submit
+ size="lg"
+ className="w-full"
+ onClick={handleClick}
+ withBlocker={false}
+ >
Sign In
</Submit>
<Button variant="link" asChild className="w-full">
diff --git a/packages/form/src/components/Submit.tsx b/packages/form/src/components/Submit.tsx
index ecfea6d6e5..b5a3c0e7d9 100644
--- a/packages/form/src/components/Submit.tsx
+++ b/packages/form/src/components/Submit.tsx
@@ -13,10 +13,13 @@ import { useBlocker, useNavigation } from "@remix-run/react";
import { forwardRef } from "react";
import { useIsSubmitting } from "../hooks";
-type SubmitProps = ButtonProps & { formId?: string; text?: string };
+type SubmitProps = ButtonProps & {
+ formId?: string;
+ withBlocker?: boolean;
+};
export const Submit = forwardRef<HTMLButtonElement, SubmitProps>(
- ({ formId, children, isDisabled, ...props }, ref) => {
+ ({ formId, children, isDisabled, withBlocker = true, ...props }, ref) => {
const isSubmitting = useIsSubmitting(formId);
const transition = useNavigation();
const isIdle = transition.state === "idle";
@@ -25,7 +28,9 @@ export const Submit = forwardRef<HTMLButtonElement, SubmitProps>(
const blocker = useBlocker(
({ currentLocation, nextLocation }) =>
- isTouched && currentLocation.pathname !== nextLocation.pathname
+ withBlocker &&
+ isTouched &&
+ currentLocation.pathname !== nextLocation.pathname
);
return (
@@ -36,7 +41,9 @@ export const Submit = forwardRef<HTMLButtonElement, SubmitProps>(
type="submit"
disabled={isDisabled || isSubmitting}
isLoading={isSubmitting}
- isDisabled={isDisabled || isSubmitting || !isIdle || !isTouched}
+ isDisabled={
+ isDisabled || isSubmitting || !isIdle || (withBlocker && !isTouched)
+ }
{...props}
>
{children}