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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
refactor: replace return redirect with throw redirect
Brad Barbinfc8edfd14324
diff --git a/apps/carbon/app/routes/_index.tsx b/apps/carbon/app/routes/_index.tsxindex 3a819cd2c5..3e94e852df 100644--- a/apps/carbon/app/routes/_index.tsx+++ b/apps/carbon/app/routes/_index.tsx@@ -5,7 +5,7 @@ import { path } from "~/utils/path";export async function loader({ request }: LoaderFunctionArgs) {await requireAuthSession(request);- return redirect(path.to.authenticatedRoot);+ throw redirect(path.to.authenticatedRoot);}export default function IndexRoute() {diff --git a/apps/carbon/app/routes/_public+/callback.tsx b/apps/carbon/app/routes/_public+/callback.tsxindex 2946c4f348..6a88b3aa1f 100644--- a/apps/carbon/app/routes/_public+/callback.tsx+++ b/apps/carbon/app/routes/_public+/callback.tsx@@ -42,7 +42,7 @@ export async function action({ request }: ActionFunctionArgs): FormActionData {const { refreshToken } = validation.data;const authSession = await refreshAccessToken(refreshToken);if (!authSession) {- return redirect(+ throw redirect(path.to.root,await flash(request, error(authSession, "Invalid refresh token")));@@ -50,7 +50,7 @@ export async function action({ request }: ActionFunctionArgs): FormActionData {const user = await getUserByEmail(authSession.email);if (user?.data) {- return redirect(path.to.resetPassord, {+ throw redirect(path.to.resetPassord, {headers: {"Set-Cookie": await commitAuthSession(request, {authSession,@@ -58,7 +58,7 @@ export async function action({ request }: ActionFunctionArgs): FormActionData {},});} else {- return redirect(+ throw redirect(path.to.root,await flash(request, error(user.error, "User not found")));diff --git a/apps/carbon/app/routes/_public+/forgot-password.tsx b/apps/carbon/app/routes/_public+/forgot-password.tsxindex b10e75abb6..0299c841c0 100644--- a/apps/carbon/app/routes/_public+/forgot-password.tsx+++ b/apps/carbon/app/routes/_public+/forgot-password.tsx@@ -38,7 +38,7 @@ export const meta: MetaFunction = () => {export async function loader({ request }: LoaderFunctionArgs) {const authSession = await getAuthSession(request);- if (authSession) return redirect(path.to.authenticatedRoot);+ if (authSession) throw redirect(path.to.authenticatedRoot);return null;}diff --git a/apps/carbon/app/routes/_public+/login.tsx b/apps/carbon/app/routes/_public+/login.tsxindex 8355901cb0..5564942ee3 100644--- a/apps/carbon/app/routes/_public+/login.tsx+++ b/apps/carbon/app/routes/_public+/login.tsx@@ -33,7 +33,7 @@ export const meta: MetaFunction = () => {export async function loader({ request }: LoaderFunctionArgs) {const authSession = await getAuthSession(request);if (authSession && (await verifyAuthSession(authSession))) {- if (authSession) return redirect(path.to.authenticatedRoot);+ if (authSession) throw redirect(path.to.authenticatedRoot);}return null;diff --git a/apps/carbon/app/routes/_public+/logout.tsx b/apps/carbon/app/routes/_public+/logout.tsxindex 264baa9e5c..29edb92907 100644--- a/apps/carbon/app/routes/_public+/logout.tsx+++ b/apps/carbon/app/routes/_public+/logout.tsx@@ -12,5 +12,5 @@ export async function action({ request }: ActionFunctionArgs) {}export async function loader() {- return redirect(path.to.root);+ throw redirect(path.to.root);}diff --git a/apps/carbon/app/routes/_public+/reset-password.tsx b/apps/carbon/app/routes/_public+/reset-password.tsxindex 5da46e7782..7ea088836e 100644--- a/apps/carbon/app/routes/_public+/reset-password.tsx+++ b/apps/carbon/app/routes/_public+/reset-password.tsx@@ -45,7 +45,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request, success("Password updated")));diff --git a/apps/carbon/app/routes/onboarding+/_layout.tsx b/apps/carbon/app/routes/onboarding+/_layout.tsxindex b9220fcb38..ca08ce32a9 100644--- a/apps/carbon/app/routes/onboarding+/_layout.tsx+++ b/apps/carbon/app/routes/onboarding+/_layout.tsx@@ -21,7 +21,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);// we don't need to do onboarding if we have a company name or locationsif (company.data?.name && locations.data?.length) {- return redirect(path.to.authenticatedRoot);+ throw redirect(path.to.authenticatedRoot);}const pathname = new URL(request.url).pathname;diff --git a/apps/carbon/app/routes/onboarding+/company.tsx b/apps/carbon/app/routes/onboarding+/company.tsxindex 8fa0e383f3..9fc7ec78a4 100644--- a/apps/carbon/app/routes/onboarding+/company.tsx+++ b/apps/carbon/app/routes/onboarding+/company.tsx@@ -119,7 +119,7 @@ export async function action({ request }: ActionFunctionArgs) {});}- return redirect(next);+ throw redirect(next);}export default function OnboardingCompany() {diff --git a/apps/carbon/app/routes/onboarding+/theme.tsx b/apps/carbon/app/routes/onboarding+/theme.tsxindex aa10810a71..472bc559e4 100644--- a/apps/carbon/app/routes/onboarding+/theme.tsx+++ b/apps/carbon/app/routes/onboarding+/theme.tsx@@ -56,7 +56,7 @@ export async function action({ request }: ActionFunctionArgs) {const { next, theme } = validation.data;if (!next) throw new Error("Fatal: next is required");- return redirect(next, {+ throw redirect(next, {headers: { "Set-Cookie": setTheme(theme) },});}diff --git a/apps/carbon/app/routes/onboarding+/user.tsx b/apps/carbon/app/routes/onboarding+/user.tsxindex e13e27cf2a..fc0eac77eb 100644--- a/apps/carbon/app/routes/onboarding+/user.tsx+++ b/apps/carbon/app/routes/onboarding+/user.tsx@@ -81,7 +81,7 @@ export async function action({ request }: ActionFunctionArgs) {throw new Error("Fatal: failed to update account");}- return redirect(next);+ throw redirect(next);}export default function OnboardingUser() {diff --git a/apps/carbon/app/routes/x+/_layout.tsx b/apps/carbon/app/routes/x+/_layout.tsxindex f470c19243..99ede9362c 100644--- a/apps/carbon/app/routes/x+/_layout.tsx+++ b/apps/carbon/app/routes/x+/_layout.tsx@@ -55,7 +55,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const requiresOnboarding = !company.data?.name;if (requiresOnboarding) {- return redirect(path.to.onboarding.root);+ throw redirect(path.to.onboarding.root);}return json({diff --git a/apps/carbon/app/routes/x+/account+/_index.tsx b/apps/carbon/app/routes/x+/account+/_index.tsxindex c9c46ad8e4..8dfce78218 100644--- a/apps/carbon/app/routes/x+/account+/_index.tsx+++ b/apps/carbon/app/routes/x+/account+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.profile);+ throw redirect(path.to.profile);}diff --git a/apps/carbon/app/routes/x+/account+/password.tsx b/apps/carbon/app/routes/x+/account+/password.tsxindex 2ef7291d90..4bd8f0d907 100644--- a/apps/carbon/app/routes/x+/account+/password.tsx+++ b/apps/carbon/app/routes/x+/account+/password.tsx@@ -57,7 +57,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request, success("Updated password")));diff --git a/apps/carbon/app/routes/x+/account+/personal.tsx b/apps/carbon/app/routes/x+/account+/personal.tsxindex c54c7726a6..2ed2ab46b8 100644--- a/apps/carbon/app/routes/x+/account+/personal.tsx+++ b/apps/carbon/app/routes/x+/account+/personal.tsx@@ -29,7 +29,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (privateAttributes.error) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request,diff --git a/apps/carbon/app/routes/x+/account+/profile.tsx b/apps/carbon/app/routes/x+/account+/profile.tsxindex d8a4817d4e..d3184a68d7 100644--- a/apps/carbon/app/routes/x+/account+/profile.tsx+++ b/apps/carbon/app/routes/x+/account+/profile.tsx@@ -41,14 +41,14 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (user.error || !user.data) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request, error(user.error, "Failed to get user")));}if (publicAttributes.error) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request,@@ -99,7 +99,7 @@ export async function action({ request }: ActionFunctionArgs) {if (photoPath === null || typeof photoPath === "string") {const avatarUpdate = await updateAvatar(client, userId, photoPath);if (avatarUpdate.error) {- return redirect(+ throw redirect(path.to.profile,await flash(request,@@ -108,7 +108,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.profile,await flash(request,@@ -116,7 +116,7 @@ export async function action({ request }: ActionFunctionArgs) {));} else {- return redirect(+ throw redirect(path.to.profile,await flash(request, error(null, "Invalid avatar path")));diff --git a/apps/carbon/app/routes/x+/accounting+/_index.tsx b/apps/carbon/app/routes/x+/accounting+/_index.tsxindex 288c8c1fa9..fb0d38e131 100644--- a/apps/carbon/app/routes/x+/accounting+/_index.tsx+++ b/apps/carbon/app/routes/x+/accounting+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.chartOfAccounts);+ throw redirect(path.to.chartOfAccounts);}diff --git a/apps/carbon/app/routes/x+/accounting+/_layout.tsx b/apps/carbon/app/routes/x+/accounting+/_layout.tsxindex aa99718f0f..b74942fd62 100644--- a/apps/carbon/app/routes/x+/accounting+/_layout.tsx+++ b/apps/carbon/app/routes/x+/accounting+/_layout.tsx@@ -38,7 +38,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (accounts.error) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request, error(accounts.error, "Failed to fetch accounts")));diff --git a/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsx b/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsxindex f83cf0309e..c448b1aa18 100644--- a/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const accountCategory = await getAccountCategory(client, categoryId);if (accountCategory.error) {- return redirect(+ throw redirect(path.to.accountingCategories,await flash(request,@@ -63,7 +63,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (updateCategory.error) {- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request,@@ -72,7 +72,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request, success("Updated G/L account category ")));diff --git a/apps/carbon/app/routes/x+/accounting+/categories.delete.$categoryId.tsx b/apps/carbon/app/routes/x+/accounting+/categories.delete.$categoryId.tsxindex 0f575be3b9..642c94f968 100644--- a/apps/carbon/app/routes/x+/accounting+/categories.delete.$categoryId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/categories.delete.$categoryId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const { categoryId } = params;if (!categoryId) {- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request, error(params, "Failed to get a category id")));@@ -21,7 +21,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const deactivateAttribute = await deleteAccountCategory(client, categoryId);if (deactivateAttribute.error) {- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request,@@ -33,7 +33,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsx b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsxindex 2c160631c8..09a2021150 100644--- a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsx@@ -24,7 +24,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const subcategory = await getAccountSubcategory(client, subcategoryId);if (subcategory.error) {- return redirect(+ throw redirect(path.to.accountingCategoryList(categoryId),await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsx b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsxindex 3699bee10e..b19b26be14 100644--- a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsx+++ b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsx@@ -51,7 +51,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(`${path.to.accountingCategories}?${getParams(request)}`);+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`);}export default function NewAccountSubcategoryRoute() {diff --git a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.tsx b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.tsxindex 00d023b16e..88a3c0ef7d 100644--- a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.tsx@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {getAccountSubcategoriesByCategory(client, categoryId),]);if (accountCategory.error) {- return redirect(+ throw redirect(path.to.accountingCategories,await flash(request,@@ -37,7 +37,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}if (accountSubcategories.error) {- return redirect(+ throw redirect(path.to.accountingCategories,await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/categories.new.tsx b/apps/carbon/app/routes/x+/accounting+/categories.new.tsxindex d25f62066d..0ae7449795 100644--- a/apps/carbon/app/routes/x+/accounting+/categories.new.tsx+++ b/apps/carbon/app/routes/x+/accounting+/categories.new.tsx@@ -39,7 +39,7 @@ export async function action({ request }: ActionFunctionArgs) {createdBy: userId,});if (createAccountCategory.error) {- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request,@@ -51,7 +51,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(`${path.to.accountingCategories}?${getParams(request)}`);+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`);}export default function NewAccountCategoryRoute() {diff --git a/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsx b/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsxindex 6565bb8fd5..7506428d57 100644--- a/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsx@@ -65,7 +65,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.chartOfAccounts,await flash(request, success("Updated account")));diff --git a/apps/carbon/app/routes/x+/accounting+/charts.delete.$accountId.tsx b/apps/carbon/app/routes/x+/accounting+/charts.delete.$accountId.tsxindex 29c3313c60..ef24c8e65c 100644--- a/apps/carbon/app/routes/x+/accounting+/charts.delete.$accountId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/charts.delete.$accountId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const account = await getAccount(client, accountId);if (account.error) {- return redirect(+ throw redirect(path.to.chartOfAccounts,await flash(request, error(account.error, "Failed to get account")));@@ -34,7 +34,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { accountId } = params;if (!accountId) {- return redirect(+ throw redirect(path.to.chartOfAccounts,await flash(request, error(params, "Failed to get an account id")));@@ -42,13 +42,13 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteTypeError } = await deleteAccount(client, accountId);if (deleteTypeError) {- return redirect(+ throw redirect(path.to.chartOfAccounts,await flash(request, error(deleteTypeError, "Failed to delete account")));}- return redirect(+ throw redirect(path.to.chartOfAccounts,await flash(request, success("Successfully deleted account")));diff --git a/apps/carbon/app/routes/x+/accounting+/charts.new.tsx b/apps/carbon/app/routes/x+/accounting+/charts.new.tsxindex cce6f526bd..31ae6167af 100644--- a/apps/carbon/app/routes/x+/accounting+/charts.new.tsx+++ b/apps/carbon/app/routes/x+/accounting+/charts.new.tsx@@ -65,7 +65,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.chartOfAccounts,await flash(request, success("Account created")));diff --git a/apps/carbon/app/routes/x+/accounting+/charts.tsx b/apps/carbon/app/routes/x+/accounting+/charts.tsxindex dbedc71e53..5cc46527f7 100644--- a/apps/carbon/app/routes/x+/accounting+/charts.tsx+++ b/apps/carbon/app/routes/x+/accounting+/charts.tsx@@ -36,7 +36,7 @@ export async function loader({ request }: LoaderFunctionArgs) {});if (chartOfAccounts.error) {- return redirect(+ throw redirect(path.to.accounting,await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx b/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsxindex 52426e73d0..fef2eefdfb 100644--- a/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx@@ -65,7 +65,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.currencies}?${getParams(request)}`,await flash(request, success("Updated currency")));diff --git a/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsx b/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsxindex 4ae33601d5..ef8d0ade35 100644--- a/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const currency = await getCurrency(client, currencyId);if (currency.error) {- return redirect(+ throw redirect(path.to.currencies,await flash(request, error(currency.error, "Failed to get currency")));@@ -34,7 +34,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { currencyId } = params;if (!currencyId) {- return redirect(+ throw redirect(`${path.to.currencies}?${getParams(request)}`,await flash(request, error(params, "Failed to get an currency id")));@@ -42,13 +42,13 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteTypeError } = await deleteCurrency(client, currencyId);if (deleteTypeError) {- return redirect(+ throw redirect(`${path.to.currencies}?${getParams(request)}`,await flash(request, error(deleteTypeError, "Failed to delete currency")));}- return redirect(+ throw redirect(`${path.to.currencies}?${getParams(request)}`,await flash(request, success("Successfully deleted currency")));diff --git a/apps/carbon/app/routes/x+/accounting+/currencies.new.tsx b/apps/carbon/app/routes/x+/accounting+/currencies.new.tsxindex 2c55fa819f..5eeba023dd 100644--- a/apps/carbon/app/routes/x+/accounting+/currencies.new.tsx+++ b/apps/carbon/app/routes/x+/accounting+/currencies.new.tsx@@ -59,7 +59,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.currencies}?${getParams(request)}`,await flash(request, success("Currency created")));diff --git a/apps/carbon/app/routes/x+/accounting+/defaults.tsx b/apps/carbon/app/routes/x+/accounting+/defaults.tsxindex 26bc542f74..a634c59a96 100644--- a/apps/carbon/app/routes/x+/accounting+/defaults.tsx+++ b/apps/carbon/app/routes/x+/accounting+/defaults.tsx@@ -31,7 +31,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const [defaultAccounts] = await Promise.all([getDefaultAccounts(client)]);if (defaultAccounts.error || !defaultAccounts.data) {- return redirect(+ throw redirect(path.to.accounting,await flash(request,@@ -73,7 +73,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.accountingDefaults,await flash(request, success("Updated default accounts")));diff --git a/apps/carbon/app/routes/x+/accounting+/groups.inventory.tsx b/apps/carbon/app/routes/x+/accounting+/groups.inventory.tsxindex 91a934c0d6..6c15eb4a90 100644--- a/apps/carbon/app/routes/x+/accounting+/groups.inventory.tsx+++ b/apps/carbon/app/routes/x+/accounting+/groups.inventory.tsx@@ -44,7 +44,7 @@ export async function loader({ request }: LoaderFunctionArgs) {getLocationsList(client),]);if (inventoryGroups.error) {- return redirect(+ throw redirect(path.to.accounting,await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/groups.purchasing.tsx b/apps/carbon/app/routes/x+/accounting+/groups.purchasing.tsxindex 050f02ef50..1c8cbf8b3d 100644--- a/apps/carbon/app/routes/x+/accounting+/groups.purchasing.tsx+++ b/apps/carbon/app/routes/x+/accounting+/groups.purchasing.tsx@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {getSupplierTypesList(client),]);if (purchasingGroups.error) {- return redirect(+ throw redirect(path.to.accounting,await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/groups.sales.tsx b/apps/carbon/app/routes/x+/accounting+/groups.sales.tsxindex da6692cf3f..7d57dd0b86 100644--- a/apps/carbon/app/routes/x+/accounting+/groups.sales.tsx+++ b/apps/carbon/app/routes/x+/accounting+/groups.sales.tsx@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {getCustomerTypesList(client),]);if (salesGroups.error) {- return redirect(+ throw redirect(path.to.accounting,await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsx b/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsxindex 68ef74a51a..f01a5f0b54 100644--- a/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsx@@ -65,7 +65,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.paymentTerms}?${getParams(request)}`,await flash(request, success("Updated payment term")));diff --git a/apps/carbon/app/routes/x+/accounting+/payment-terms.delete.$paymentTermId.tsx b/apps/carbon/app/routes/x+/accounting+/payment-terms.delete.$paymentTermId.tsxindex dc33b0858b..25078a20ab 100644--- a/apps/carbon/app/routes/x+/accounting+/payment-terms.delete.$paymentTermId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/payment-terms.delete.$paymentTermId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const paymentTerm = await getPaymentTerm(client, paymentTermId);if (paymentTerm.error) {- return redirect(+ throw redirect(`${path.to.paymentTerms}?${getParams(request)}`,await flash(request,@@ -37,7 +37,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { paymentTermId } = params;if (!paymentTermId) {- return redirect(+ throw redirect(`${path.to.paymentTerms}?${getParams(request)}`,await flash(request, error(params, "Failed to get an payment term id")));@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {paymentTermId);if (deleteTypeError) {- return redirect(+ throw redirect(`${path.to.paymentTerms}?${getParams(request)}`,await flash(request,@@ -57,7 +57,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.paymentTerms}?${getParams(request)}`,await flash(request, success("Successfully deleted payment term")));diff --git a/apps/carbon/app/routes/x+/accounting+/payment-terms.new.tsx b/apps/carbon/app/routes/x+/accounting+/payment-terms.new.tsxindex 6dd89b46be..dd376cd86f 100644--- a/apps/carbon/app/routes/x+/accounting+/payment-terms.new.tsx+++ b/apps/carbon/app/routes/x+/accounting+/payment-terms.new.tsx@@ -68,7 +68,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.paymentTerms}?${getParams(request)}`,await flash(request, success("Payment term created")));diff --git a/apps/carbon/app/routes/x+/accounting+/subcategory.$subcategoryId.tsx b/apps/carbon/app/routes/x+/accounting+/subcategory.$subcategoryId.tsxindex 5260f0a5ae..27b544060d 100644--- a/apps/carbon/app/routes/x+/accounting+/subcategory.$subcategoryId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/subcategory.$subcategoryId.tsx@@ -47,7 +47,7 @@ export async function action({ request, params }: ActionFunctionArgs) {));- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request, success("Successfully updated G/L subcategory")));diff --git a/apps/carbon/app/routes/x+/accounting+/subcategory.delete.$subcategoryId.tsx b/apps/carbon/app/routes/x+/accounting+/subcategory.delete.$subcategoryId.tsxindex b55450da29..42595754c5 100644--- a/apps/carbon/app/routes/x+/accounting+/subcategory.delete.$subcategoryId.tsx+++ b/apps/carbon/app/routes/x+/accounting+/subcategory.delete.$subcategoryId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const { subcategoryId } = params;if (!subcategoryId) {- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request,@@ -27,7 +27,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {subcategoryId);if (deactivateSubcategory.error) {- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request,@@ -39,7 +39,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.accountingCategories}?${getParams(request)}`,await flash(request,diff --git a/apps/carbon/app/routes/x+/accounting+/years.tsx b/apps/carbon/app/routes/x+/accounting+/years.tsxindex eb8b23082e..cd402ef887 100644--- a/apps/carbon/app/routes/x+/accounting+/years.tsx+++ b/apps/carbon/app/routes/x+/accounting+/years.tsx@@ -28,7 +28,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const settings = await getFiscalYearSettings(client);if (settings.error) {- return redirect(+ throw redirect(path.to.accounting,await flash(request,@@ -59,7 +59,7 @@ export async function action({ request }: ActionFunctionArgs) {updatedBy: userId,});if (update.error) {- return redirect(+ throw redirect(path.to.fiscalYears,await flash(request,@@ -68,7 +68,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.fiscalYears,await flash(request, success("Successfully updated fiscal year settings")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId._index.tsx b/apps/carbon/app/routes/x+/customer+/$customerId._index.tsxindex 02eb6fefb1..a12453147f 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId._index.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId._index.tsx@@ -5,5 +5,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { customerId } = params;if (!customerId) throw new Error("Could not find customerId");- return redirect(path.to.customerDetails(customerId));+ throw redirect(path.to.customerDetails(customerId));}diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsxindex 55bbc80cdd..57b6e2fb4c 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const contact = await getCustomerContact(client, customerContactId);if (contact.error) {- return redirect(+ throw redirect(path.to.customerContacts(customerId),await flash(request,@@ -74,7 +74,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (update.error) {- return redirect(+ throw redirect(path.to.customerContacts(customerId),await flash(request,@@ -83,7 +83,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customerContacts(customerId),await flash(request, success("Customer contact updated")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.delete.$customerContactId.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.delete.$customerContactId.tsxindex 52e2130961..439bddd56d 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.delete.$customerContactId.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.delete.$customerContactId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { customerId, customerContactId } = params;if (!customerId || !customerContactId) {- return redirect(+ throw redirect(path.to.customers,await flash(request, error(params, "Failed to get a customer contact id")));@@ -27,7 +27,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customerContactId);if (deleteCustomerContactError) {- return redirect(+ throw redirect(path.to.customerContacts(customerId),await flash(request,@@ -36,7 +36,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customerContacts(customerId),await flash(request, success("Successfully deleted customer contact")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.tsxindex ac79ce8cf3..5192a0cdee 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.tsx@@ -17,7 +17,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const contacts = await getCustomerContacts(client, customerId);if (contacts.error) {- return redirect(+ throw redirect(path.to.customer(customerId),await flash(request,diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.details.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.details.tsxindex 0071a25029..41b4970b36 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.details.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.details.tsx@@ -32,7 +32,7 @@ export async function action({ request }: ActionFunctionArgs) {const { id, ...data } = validation.data;if (!id) {- return redirect(+ throw redirect(path.to.customers,await flash(request, error(null, "Failed to update customer")));@@ -45,7 +45,7 @@ export async function action({ request }: ActionFunctionArgs) {updatedBy: userId,});if (update.error) {- return redirect(+ throw redirect(path.to.customers,await flash(request, error(update.error, "Failed to update customer")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsxindex 8790ee6ddb..6ace61dcfc 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const location = await getCustomerLocation(client, customerLocationId);if (location.error) {- return redirect(+ throw redirect(path.to.customerLocations(customerId),await flash(request,@@ -70,7 +70,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (update.error) {- return redirect(+ throw redirect(path.to.customerLocations(customerId),await flash(request,@@ -79,7 +79,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customerLocations(customerId),await flash(request, success("Customer address updated")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.locations.delete.$customerLocationId.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.locations.delete.$customerLocationId.tsxindex 433ff756b4..09ecad81cd 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.locations.delete.$customerLocationId.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.locations.delete.$customerLocationId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { customerId, customerLocationId } = params;if (!customerId || !customerLocationId) {- return redirect(+ throw redirect(path.to.customers,await flash(request,@@ -28,7 +28,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customerLocationId);if (deleteCustomerLocationError) {- return redirect(+ throw redirect(path.to.customerLocations(customerId),await flash(request,@@ -37,7 +37,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customerLocations(customerId),await flash(request, success("Successfully deleted customer location")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.locations.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.locations.tsxindex ead8e22f1c..284e5ab606 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.locations.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.locations.tsx@@ -17,7 +17,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const locations = await getCustomerLocations(client, customerId);if (locations.error) {- return redirect(+ throw redirect(path.to.customer(customerId),await flash(request,diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsxindex aa87c938de..6598321a05 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsx@@ -25,7 +25,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customerPayment = await getCustomerPayment(client, customerId);if (customerPayment.error || !customerPayment.data) {- return redirect(+ throw redirect(path.to.customer(customerId),await flash(request,@@ -63,7 +63,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (update.error) {- return redirect(+ throw redirect(path.to.customer(customerId),await flash(request,@@ -72,7 +72,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customerPayment(customerId),await flash(request, success("Updated customer payment")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsxindex 77f077f436..ab90e863ef 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsx@@ -25,7 +25,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customerShipping = await getCustomerShipping(client, customerId);if (customerShipping.error || !customerShipping.data) {- return redirect(+ throw redirect(path.to.customer(customerId),await flash(request,@@ -63,7 +63,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (update.error) {- return redirect(+ throw redirect(path.to.customer(customerId),await flash(request,@@ -72,7 +72,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customerShipping(customerId),await flash(request, success("Updated customer shipping")));diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.tsxindex de241b172b..95505d7b13 100644--- a/apps/carbon/app/routes/x+/customer+/$customerId.tsx+++ b/apps/carbon/app/routes/x+/customer+/$customerId.tsx@@ -34,7 +34,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (customer.error) {- return redirect(+ throw redirect(path.to.customers,await flash(request,diff --git a/apps/carbon/app/routes/x+/documents+/$documentId.delete.tsx b/apps/carbon/app/routes/x+/documents+/$documentId.delete.tsxindex 1e1d05d9d6..5fa4c24c9b 100644--- a/apps/carbon/app/routes/x+/documents+/$documentId.delete.tsx+++ b/apps/carbon/app/routes/x+/documents+/$documentId.delete.tsx@@ -19,7 +19,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const moveToTrash = await deleteDocument(client, documentId, userId);if (moveToTrash.error) {- return redirect(+ throw redirect(path.to.documents,await flash(request,@@ -28,5 +28,5 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.documents);+ throw redirect(path.to.documents);}diff --git a/apps/carbon/app/routes/x+/documents+/$documentId.labels.tsx b/apps/carbon/app/routes/x+/documents+/$documentId.labels.tsxindex b64a0bfa29..23f83eab0e 100644--- a/apps/carbon/app/routes/x+/documents+/$documentId.labels.tsx+++ b/apps/carbon/app/routes/x+/documents+/$documentId.labels.tsx@@ -33,7 +33,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (updateLabels.error) {- return redirect(+ throw redirect(path.to.documents,await flash(request,@@ -42,5 +42,5 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(path.to.documents);+ throw redirect(path.to.documents);}diff --git a/apps/carbon/app/routes/x+/documents+/$documentId.restore.tsx b/apps/carbon/app/routes/x+/documents+/$documentId.restore.tsxindex 86de9ee97a..b320ed6db6 100644--- a/apps/carbon/app/routes/x+/documents+/$documentId.restore.tsx+++ b/apps/carbon/app/routes/x+/documents+/$documentId.restore.tsx@@ -19,7 +19,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const removeFromTrash = await restoreDocument(client, documentId, userId);if (removeFromTrash.error) {- return redirect(+ throw redirect(path.to.documents,await flash(request,@@ -28,5 +28,5 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.documentsTrash);+ throw redirect(path.to.documentsTrash);}diff --git a/apps/carbon/app/routes/x+/documents+/_index.tsx b/apps/carbon/app/routes/x+/documents+/_index.tsxindex 497293ac06..c219f9a3f9 100644--- a/apps/carbon/app/routes/x+/documents+/_index.tsx+++ b/apps/carbon/app/routes/x+/documents+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.documents);+ throw redirect(path.to.documents);}diff --git a/apps/carbon/app/routes/x+/documents+/new.tsx b/apps/carbon/app/routes/x+/documents+/new.tsxindex c38dc9bcde..2882c101f6 100644--- a/apps/carbon/app/routes/x+/documents+/new.tsx+++ b/apps/carbon/app/routes/x+/documents+/new.tsx@@ -29,7 +29,7 @@ export async function action({ request }: ActionFunctionArgs) {createdBy: userId,});if (createDocument.error) {- return redirect(+ throw redirect(path.to.documents,await flash(request,@@ -38,7 +38,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.documents,await flash(request, success(`Successfully uploaded ${name}`)));diff --git a/apps/carbon/app/routes/x+/documents+/search.$documentId.tsx b/apps/carbon/app/routes/x+/documents+/search.$documentId.tsxindex e3e641df9f..c0940633a5 100644--- a/apps/carbon/app/routes/x+/documents+/search.$documentId.tsx+++ b/apps/carbon/app/routes/x+/documents+/search.$documentId.tsx@@ -25,7 +25,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const document = await getDocument(client, documentId);if (document.error) {- return redirect(+ throw redirect(path.to.documents,await flash(request, error(document.error, "Failed to get document")));@@ -61,7 +61,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (updateDocument.error) {- return redirect(+ throw redirect(path.to.documents,await flash(request,@@ -70,7 +70,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.documents,await flash(request, success("Updated document")));diff --git a/apps/carbon/app/routes/x+/inventory+/_index.tsx b/apps/carbon/app/routes/x+/inventory+/_index.tsxindex 9ce16c7e3c..9b29ac26e3 100644--- a/apps/carbon/app/routes/x+/inventory+/_index.tsx+++ b/apps/carbon/app/routes/x+/inventory+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.receipts);+ throw redirect(path.to.receipts);}diff --git a/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.post.tsx b/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.post.tsxindex 39a73af3b0..28cd0f57be 100644--- a/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.post.tsx+++ b/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.post.tsx@@ -23,7 +23,7 @@ export async function action({ request, params }: ActionFunctionArgs) {.eq("id", receiptId);if (setPendingState.error) {- return redirect(+ throw redirect(path.to.receipts,await flash(request,@@ -40,7 +40,7 @@ export async function action({ request, params }: ActionFunctionArgs) {},});- return redirect(path.to.receipts);+ throw redirect(path.to.receipts);}export default function ReceiptPostRoute() {diff --git a/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsx b/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsxindex a40b58cacb..fe24f8cbf4 100644--- a/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsx+++ b/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsx@@ -72,7 +72,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.receipt(id),await flash(request, success("Updated receipt")));diff --git a/apps/carbon/app/routes/x+/inventory+/receipts.delete.$receiptId.tsx b/apps/carbon/app/routes/x+/inventory+/receipts.delete.$receiptId.tsxindex eb29373670..890548e1e1 100644--- a/apps/carbon/app/routes/x+/inventory+/receipts.delete.$receiptId.tsx+++ b/apps/carbon/app/routes/x+/inventory+/receipts.delete.$receiptId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const receipt = await getReceipt(client, receiptId);if (receipt.error) {- return redirect(+ throw redirect(path.to.receipts,await flash(request, error(receipt.error, "Failed to get receipt")));@@ -34,7 +34,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { receiptId } = params;if (!receiptId) {- return redirect(+ throw redirect(path.to.receipts,await flash(request, error(params, "Failed to get an receipt id")));@@ -46,14 +46,14 @@ export async function action({ request, params }: ActionFunctionArgs) {receiptId);if (getReceiptError) {- return redirect(+ throw redirect(path.to.receipts,await flash(request, error(getReceiptError, "Failed to get receipt")));}if (receipt?.postingDate) {- return redirect(+ throw redirect(path.to.receipts,await flash(request,@@ -64,7 +64,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteReceiptError } = await deleteReceipt(client, receiptId);if (deleteReceiptError) {- return redirect(+ throw redirect(path.to.receipts,await flash(request,@@ -73,7 +73,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.receipts,await flash(request, success("Successfully deleted receipt")));diff --git a/apps/carbon/app/routes/x+/inventory+/receipts.new.tsx b/apps/carbon/app/routes/x+/inventory+/receipts.new.tsxindex b4c5ac7432..a81044cd69 100644--- a/apps/carbon/app/routes/x+/inventory+/receipts.new.tsx+++ b/apps/carbon/app/routes/x+/inventory+/receipts.new.tsx@@ -27,7 +27,7 @@ export async function loader({ request }: LoaderFunctionArgs) {getUserDefaults(client, userId),]);if (nextSequence.error) {- return redirect(+ throw redirect(request.headers.get("Referer") ?? path.to.receipts,await flash(request,@@ -66,7 +66,7 @@ export async function loader({ request }: LoaderFunctionArgs) {});if (insertReceipt.error) {await rollbackNextSequence(client, "receipt", userId);- return redirect(+ throw redirect(request.headers.get("Referer") ?? path.to.receipts,await flash(request,@@ -75,5 +75,5 @@ export async function loader({ request }: LoaderFunctionArgs) {);}- return redirect(path.to.receipt(insertReceipt.data.id));+ throw redirect(path.to.receipt(insertReceipt.data.id));}diff --git a/apps/carbon/app/routes/x+/inventory+/receipts.tsx b/apps/carbon/app/routes/x+/inventory+/receipts.tsxindex 5febcd80d7..a57507e9ec 100644--- a/apps/carbon/app/routes/x+/inventory+/receipts.tsx+++ b/apps/carbon/app/routes/x+/inventory+/receipts.tsx@@ -39,7 +39,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (receipts.error) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request, error(null, "Error loading receipts")));diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsxindex 6741747f31..7b46d825bf 100644--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx@@ -67,7 +67,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.shippingMethods}?${getParams(request)}`,await flash(request, success("Updated shipping method")));diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsxindex ebb5717345..d38566dd2d 100644--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsx+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const shippingMethod = await getShippingMethod(client, shippingMethodId);if (shippingMethod.error) {- return redirect(+ throw redirect(path.to.shippingMethods,await flash(request,@@ -37,7 +37,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { shippingMethodId } = params;if (!shippingMethodId) {- return redirect(+ throw redirect(path.to.shippingMethods,await flash(request, error(params, "Failed to get an shipping method id")));@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {shippingMethodId);if (deleteTypeError) {- return redirect(+ throw redirect(path.to.shippingMethods,await flash(request,@@ -57,7 +57,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.shippingMethods}?${getParams(request)}`,await flash(request, success("Successfully deleted shipping method")));diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.new.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.new.tsxindex 968e346263..112aa8c790 100644--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.new.tsx+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.new.tsx@@ -65,7 +65,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.shippingMethods}?${getParams(request)}`,await flash(request, success("Shipping method created")));diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.tsxindex 8be115ad28..4fd5d36df1 100644--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.tsx+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.tsx@@ -40,7 +40,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (shippingMethods.error) {- return redirect(+ throw redirect(path.to.inventory,await flash(request, error(null, "Error loading shipping methods")));diff --git a/apps/carbon/app/routes/x+/invoicing+/_index.tsx b/apps/carbon/app/routes/x+/invoicing+/_index.tsxindex 2961cb4b9f..624ba08d71 100644--- a/apps/carbon/app/routes/x+/invoicing+/_index.tsx+++ b/apps/carbon/app/routes/x+/invoicing+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.purchaseInvoices);+ throw redirect(path.to.purchaseInvoices);}diff --git a/apps/carbon/app/routes/x+/part+/$partId._index.tsx b/apps/carbon/app/routes/x+/part+/$partId._index.tsxindex ecdba33351..6fcd70cea4 100644--- a/apps/carbon/app/routes/x+/part+/$partId._index.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId._index.tsx@@ -5,5 +5,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { partId } = params;if (!partId) throw new Error("Could not find partId");- return redirect(path.to.partDetails(partId));+ throw redirect(path.to.partDetails(partId));}diff --git a/apps/carbon/app/routes/x+/part+/$partId.costing.tsx b/apps/carbon/app/routes/x+/part+/$partId.costing.tsxindex d3f37ff0d3..dac7a09e84 100644--- a/apps/carbon/app/routes/x+/part+/$partId.costing.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.costing.tsx@@ -30,13 +30,13 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (partCost.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request, error(partCost.error, "Failed to load part costing")));}if (accounts.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request, error(accounts.error, "Failed to load accounts")));@@ -71,7 +71,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updatePartCost.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -80,7 +80,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partCosting(partId),await flash(request, success("Updated part costing")));diff --git a/apps/carbon/app/routes/x+/part+/$partId.details.tsx b/apps/carbon/app/routes/x+/part+/$partId.details.tsxindex 92faa316f2..d13b61ff50 100644--- a/apps/carbon/app/routes/x+/part+/$partId.details.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.details.tsx@@ -35,13 +35,13 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (updatePart.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request, error(updatePart.error, "Failed to update part")));}- return redirect(+ throw redirect(path.to.part(partId),await flash(request, success("Updated part")));diff --git a/apps/carbon/app/routes/x+/part+/$partId.inventory.tsx b/apps/carbon/app/routes/x+/part+/$partId.inventory.tsxindex bd6f3fee6c..fa003cb86e 100644--- a/apps/carbon/app/routes/x+/part+/$partId.inventory.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.inventory.tsx@@ -36,7 +36,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {if (!locationId) {const userDefaults = await getUserDefaults(client, userId);if (userDefaults.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -51,7 +51,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {if (!locationId) {const locations = await getLocationsList(client);if (locations.error || !locations.data?.length) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -76,7 +76,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {});if (insertPartInventory.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -87,7 +87,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {partInventory = await getPartInventory(client, partId, locationId);if (partInventory.error || !partInventory.data) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -98,7 +98,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}if (shelves.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request, error(shelves.error, "Failed to load shelves")));@@ -106,7 +106,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const quantities = await getPartQuantities(client, partId, locationId);if (quantities.error || !quantities.data) {- return redirect(+ throw redirect(path.to.parts,await flash(request, error(quantities, "Failed to load part quantities")));@@ -145,7 +145,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (updatePartInventory.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -154,7 +154,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partInventoryLocation(partId, update.locationId),await flash(request, success("Updated part inventory")));diff --git a/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsx b/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsxindex ce87b10797..2e12209a24 100644--- a/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const partManufacturing = await getPartManufacturing(client, partId);if (partManufacturing.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request,@@ -68,7 +68,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updatePartManufacturing.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -80,7 +80,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partManufacturing(partId),await flash(request, success("Updated part manufacturing")));diff --git a/apps/carbon/app/routes/x+/part+/$partId.planning.tsx b/apps/carbon/app/routes/x+/part+/$partId.planning.tsxindex 3b0be8e931..1e79b5b37d 100644--- a/apps/carbon/app/routes/x+/part+/$partId.planning.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.planning.tsx@@ -34,7 +34,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {if (!locationId) {const userDefaults = await getUserDefaults(client, userId);if (userDefaults.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -49,7 +49,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {if (!locationId) {const locations = await getLocationsList(client);if (locations.error || !locations.data?.length) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -70,7 +70,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {});if (insertPartPlanning.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -81,7 +81,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {partPlanning = await getPartPlanning(client, partId, locationId);if (partPlanning.error || !partPlanning.data) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -119,7 +119,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updatePartPlanning.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -128,7 +128,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partPlanningLocation(partId, validation.data.locationId),await flash(request, success("Updated part planning")));diff --git a/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsx b/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsxindex cdb19365e9..b9a6b807ec 100644--- a/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsx@@ -25,7 +25,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const partPurchasing = await getPartPurchasing(client, partId);if (partPurchasing.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request,@@ -63,7 +63,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (updatePartPurchasing.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -72,7 +72,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partPurchasing(partId),await flash(request, success("Updated part purchasing")));diff --git a/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsx b/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsxindex 539e409386..a1777abf06 100644--- a/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsx@@ -28,7 +28,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (partUnitSalePrice.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request,@@ -67,7 +67,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updatePartUnitSalePrice.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,@@ -76,7 +76,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partSalePrice(partId),await flash(request, success("Updated part sale price")));diff --git a/apps/carbon/app/routes/x+/part+/$partId.suppliers.new.tsx b/apps/carbon/app/routes/x+/part+/$partId.suppliers.new.tsxindex acee77f002..d3af3840d0 100644--- a/apps/carbon/app/routes/x+/part+/$partId.suppliers.new.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.suppliers.new.tsx@@ -39,7 +39,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createPartSupplier.error) {- return redirect(+ throw redirect(path.to.partSuppliers(partId),await flash(request,@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.partSuppliers(partId));+ throw redirect(path.to.partSuppliers(partId));}export default function NewPartSupplierRoute() {diff --git a/apps/carbon/app/routes/x+/part+/$partId.suppliers.tsx b/apps/carbon/app/routes/x+/part+/$partId.suppliers.tsxindex 6d483b73ce..24a3a848db 100644--- a/apps/carbon/app/routes/x+/part+/$partId.suppliers.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.suppliers.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const [partSuppliers] = await Promise.all([getPartSuppliers(client, partId)]);if (partSuppliers.error) {- return redirect(+ throw redirect(path.to.part(partId),await flash(request,diff --git a/apps/carbon/app/routes/x+/part+/$partId.tsx b/apps/carbon/app/routes/x+/part+/$partId.tsxindex db3632439e..6dd4866e5f 100644--- a/apps/carbon/app/routes/x+/part+/$partId.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const [partSummary] = await Promise.all([getPartSummary(client, partId)]);if (partSummary.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request,diff --git a/apps/carbon/app/routes/x+/parts+/_index.tsx b/apps/carbon/app/routes/x+/parts+/_index.tsxindex 534c184bec..8555df1c73 100644--- a/apps/carbon/app/routes/x+/parts+/_index.tsx+++ b/apps/carbon/app/routes/x+/parts+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.partsSearch);+ throw redirect(path.to.partsSearch);}diff --git a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsxindex 416180c200..d63788a07b 100644--- a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx@@ -64,7 +64,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.partGroups}?${getParams(request)}`,await flash(request, success("Updated part group")));diff --git a/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsx b/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsxindex 7f63a6084c..f2b73e762b 100644--- a/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const partGroup = await getPartGroup(client, groupId);if (partGroup.error) {- return redirect(+ throw redirect(path.to.partGroups,await flash(request, error(partGroup.error, "Failed to get part group")));@@ -34,7 +34,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { groupId } = params;if (!groupId) {- return redirect(+ throw redirect(path.to.partGroups,await flash(request, error(params, "Failed to get an part group id")));@@ -42,7 +42,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteTypeError } = await deletePartGroup(client, groupId);if (deleteTypeError) {- return redirect(+ throw redirect(`${path.to.partGroups}?${getParams(request)}`,await flash(request,@@ -51,7 +51,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partGroups,await flash(request, success("Successfully deleted part group")));diff --git a/apps/carbon/app/routes/x+/parts+/groups.tsx b/apps/carbon/app/routes/x+/parts+/groups.tsxindex 15f42903e2..70118547ee 100644--- a/apps/carbon/app/routes/x+/parts+/groups.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.tsx@@ -40,14 +40,14 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (partGroups.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request, error(null, "Error loading part groups")));}if (accounts.error) {- return redirect(+ throw redirect(path.to.partGroups,await flash(request, error(accounts.error, "Error loading accounts")));diff --git a/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx b/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsxindex 4e85d2fad0..4aeef49376 100644--- a/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx+++ b/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx@@ -64,7 +64,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.uoms}?${getParams(request)}`,await flash(request, success("Updated unit of measure")));diff --git a/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsx b/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsxindex 4b393b1b22..675baad824 100644--- a/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsx+++ b/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const unitOfMeasure = await getUnitOfMeasure(client, uomId);if (unitOfMeasure.error) {- return redirect(+ throw redirect(`${path.to.uoms}?${getParams(request)}`,await flash(request,@@ -37,7 +37,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { uomId } = params;if (!uomId) {- return redirect(+ throw redirect(path.to.uoms,await flash(request, error(params, "Failed to get an unit of measure id")));@@ -45,7 +45,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteTypeError } = await deleteUnitOfMeasure(client, uomId);if (deleteTypeError) {- return redirect(+ throw redirect(path.to.uoms,await flash(request,@@ -54,7 +54,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.uoms,await flash(request, success("Successfully deleted unit of measure")));diff --git a/apps/carbon/app/routes/x+/person+/$personId._index.tsx b/apps/carbon/app/routes/x+/person+/$personId._index.tsxindex 957905810c..224427ac08 100644--- a/apps/carbon/app/routes/x+/person+/$personId._index.tsx+++ b/apps/carbon/app/routes/x+/person+/$personId._index.tsx@@ -5,5 +5,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { personId } = params;if (!personId) throw new Error("Could not find personId");- return redirect(path.to.personDetails(personId));+ throw redirect(path.to.personDetails(personId));}diff --git a/apps/carbon/app/routes/x+/person+/$personId.details.tsx b/apps/carbon/app/routes/x+/person+/$personId.details.tsxindex 95b0cefd9f..4a4a632794 100644--- a/apps/carbon/app/routes/x+/person+/$personId.details.tsx+++ b/apps/carbon/app/routes/x+/person+/$personId.details.tsx@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const account = await getAccount(client, personId);if (account.error) {- return redirect(+ throw redirect(path.to.people,await flash(request, error(account.error, "Failed to load account")));diff --git a/apps/carbon/app/routes/x+/person+/$personId.job.tsx b/apps/carbon/app/routes/x+/person+/$personId.job.tsxindex 0ba911a141..fb8a873570 100644--- a/apps/carbon/app/routes/x+/person+/$personId.job.tsx+++ b/apps/carbon/app/routes/x+/person+/$personId.job.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const job = await getEmployeeJob(client, personId);if (job.error) {- return redirect(+ throw redirect(path.to.people,await flash(request, error(job.error, "Failed to load job")));@@ -58,13 +58,13 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updateJob.error) {- return redirect(+ throw redirect(path.to.personJob(personId),await flash(request, error(updateJob.error, "Failed to update job")));}- return redirect(+ throw redirect(path.to.personJob(personId),await flash(request, success("Successfully updated job")));diff --git a/apps/carbon/app/routes/x+/person+/$personId.notes.tsx b/apps/carbon/app/routes/x+/person+/$personId.notes.tsxindex 973e353c16..59dab71eee 100644--- a/apps/carbon/app/routes/x+/person+/$personId.notes.tsx+++ b/apps/carbon/app/routes/x+/person+/$personId.notes.tsx@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const notes = await getNotes(client, personId);if (notes.error) {- return redirect(+ throw redirect(path.to.people,await flash(request,diff --git a/apps/carbon/app/routes/x+/person+/$personId.private.tsx b/apps/carbon/app/routes/x+/person+/$personId.private.tsxindex f9415532d7..28fe9090cf 100644--- a/apps/carbon/app/routes/x+/person+/$personId.private.tsx+++ b/apps/carbon/app/routes/x+/person+/$personId.private.tsx@@ -23,7 +23,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const privateAttributes = await getPrivateAttributes(client, personId);if (privateAttributes.error) {- return redirect(+ throw redirect(path.to.people,await flash(request,@@ -55,13 +55,13 @@ export async function action({ request, params }: ActionFunctionArgs) {const updateJob = await upsertEmployeeJob(client, personId, validation.data);if (updateJob.error) {- return redirect(+ throw redirect(path.to.personJob(personId),await flash(request, error(updateJob.error, "Failed to update job")));}- return redirect(+ throw redirect(path.to.personJob(personId),await flash(request, success("Successfully updated job")));diff --git a/apps/carbon/app/routes/x+/person+/$personId.public.tsx b/apps/carbon/app/routes/x+/person+/$personId.public.tsxindex d15b543668..d43519e1b8 100644--- a/apps/carbon/app/routes/x+/person+/$personId.public.tsx+++ b/apps/carbon/app/routes/x+/person+/$personId.public.tsx@@ -23,7 +23,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const publicAttributes = await getPublicAttributes(client, personId);if (publicAttributes.error) {- return redirect(+ throw redirect(path.to.people,await flash(request,@@ -55,13 +55,13 @@ export async function action({ request, params }: ActionFunctionArgs) {const updateJob = await upsertEmployeeJob(client, personId, validation.data);if (updateJob.error) {- return redirect(+ throw redirect(path.to.personJob(personId),await flash(request, error(updateJob.error, "Failed to update job")));}- return redirect(+ throw redirect(path.to.personJob(personId),await flash(request, success("Successfully updated job")));diff --git a/apps/carbon/app/routes/x+/person+/$personId.tsx b/apps/carbon/app/routes/x+/person+/$personId.tsxindex 52923dee7f..e0bd572a6e 100644--- a/apps/carbon/app/routes/x+/person+/$personId.tsx+++ b/apps/carbon/app/routes/x+/person+/$personId.tsx@@ -36,7 +36,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (employeeSummary.error) {- return redirect(+ throw redirect(path.to.people,await flash(request,diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId._index.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId._index.tsxindex 62d1ce88cd..35dea97409 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId._index.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId._index.tsx@@ -6,5 +6,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { invoiceId } = params;if (!invoiceId) throw notFound("Could not find invoiceId");- return redirect(path.to.purchaseInvoiceDetails(invoiceId));+ throw redirect(path.to.purchaseInvoiceDetails(invoiceId));}diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsxindex de0de96bc8..c9def70389 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx@@ -46,7 +46,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updatePurchaseInvoice.error) {- return redirect(+ throw redirect(path.to.purchaseInvoice(id),await flash(request,@@ -55,7 +55,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.purchaseInvoice(id),await flash(request, success("Updated purchase invoice")));diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsxindex 1cee4df481..39d22d7e7e 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsx@@ -84,7 +84,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (updatePurchaseInvoiceLine.error) {- return redirect(+ throw redirect(path.to.purchaseInvoiceLines(invoiceId),await flash(request,@@ -96,7 +96,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.purchaseInvoiceLines(invoiceId));+ throw redirect(path.to.purchaseInvoiceLines(invoiceId));}export default function EditPurchaseInvoiceLineRoute() {diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.delete.$lineId.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.delete.$lineId.tsxindex eccd184f9c..560e50062f 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.delete.$lineId.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.delete.$lineId.tsx@@ -22,7 +22,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const purchaseInvoiceLine = await getPurchaseInvoiceLine(client, lineId);if (purchaseInvoiceLine.error) {- return redirect(+ throw redirect(path.to.purchaseInvoiceLines(invoiceId),await flash(request,@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {lineId);if (deleteTypeError) {- return redirect(+ throw redirect(path.to.purchaseInvoiceLines(invoiceId),await flash(request,@@ -57,7 +57,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.purchaseInvoiceLines(invoiceId),await flash(request, success("Successfully deleted purchase invoice line")));diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsxindex d605eadb27..a9bfdbbb64 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsx@@ -42,7 +42,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createPurchaseInvoiceLine.error) {- return redirect(+ throw redirect(path.to.purchaseInvoiceLines(invoiceId),await flash(request,@@ -54,7 +54,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.purchaseInvoiceLines(invoiceId));+ throw redirect(path.to.purchaseInvoiceLines(invoiceId));}export default function NewPurchaseInvoiceLineRoute() {diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.tsxindex 9213cb5549..7af8db20ed 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.tsx@@ -39,7 +39,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (updatePurchaseInvoice.error) {- return redirect(+ throw redirect(path.to.purchaseInvoice(id),await flash(request,@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.purchaseInvoice(id),await flash(request, success("Updated purchase invoice")));diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.post.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.post.tsxindex 939f838b0b..5788f33e7e 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.post.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.post.tsx@@ -22,7 +22,7 @@ export async function action({ request, params }: ActionFunctionArgs) {.eq("id", invoiceId);if (setPendingState.error) {- return redirect(+ throw redirect(path.to.purchaseInvoices,await flash(request,@@ -39,5 +39,5 @@ export async function action({ request, params }: ActionFunctionArgs) {},});- return redirect(path.to.purchaseInvoices);+ throw redirect(path.to.purchaseInvoices);}diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.tsxindex 695f235d35..13fdc1725e 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.tsx@@ -36,7 +36,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (purchaseInvoice.error) {- return redirect(+ throw redirect(path.to.purchaseInvoices,await flash(request,@@ -53,7 +53,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}export async function action({ request }: ActionFunctionArgs) {- return redirect(request.headers.get("Referer") ?? request.url);+ throw redirect(request.headers.get("Referer") ?? request.url);}export default function PurchaseInvoiceRoute() {diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/delete.$invoiceId.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/delete.$invoiceId.tsxindex 109b8582ae..270a514e42 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/delete.$invoiceId.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/delete.$invoiceId.tsx@@ -19,7 +19,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const remove = await deletePurchaseInvoice(client, invoiceId);if (remove.error) {- return redirect(+ throw redirect(path.to.purchaseInvoices,await flash(request,@@ -28,5 +28,5 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.purchaseInvoices);+ throw redirect(path.to.purchaseInvoices);}diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/new.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/new.tsxindex f6f6420516..7e74df6478 100644--- a/apps/carbon/app/routes/x+/purchase-invoice+/new.tsx+++ b/apps/carbon/app/routes/x+/purchase-invoice+/new.tsx@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {);if (result.error || !result?.data) {- return redirect(+ throw redirect(request.headers.get("Referer") ?? path.to.purchaseOrders,await flash(request,@@ -52,7 +52,7 @@ export async function loader({ request }: LoaderFunctionArgs) {);}- return redirect(path.to.purchaseInvoice(result.data?.id!));+ throw redirect(path.to.purchaseInvoice(result.data?.id!));case "Receipt":if (!sourceDocumentId) throw new Error("Missing sourceDocumentId");@@ -60,7 +60,7 @@ export async function loader({ request }: LoaderFunctionArgs) {result = await createPurchaseInvoiceFromReceipt(sourceDocumentId, userId);if (result.error || !result?.data) {- return redirect(+ throw redirect(request.headers.get("Referer") ?? path.to.receipts,await flash(request,@@ -69,7 +69,7 @@ export async function loader({ request }: LoaderFunctionArgs) {);}- return redirect(path.to.purchaseInvoice(result.data?.id!));+ throw redirect(path.to.purchaseInvoice(result.data?.id!));default:return null;@@ -93,7 +93,7 @@ export async function action({ request }: ActionFunctionArgs) {const nextSequence = await getNextSequence(client, "purchaseInvoice", userId);if (nextSequence.error) {- return redirect(+ throw redirect(path.to.newPurchaseInvoice,await flash(request,@@ -113,7 +113,7 @@ export async function action({ request }: ActionFunctionArgs) {if (createPurchaseInvoice.error || !createPurchaseInvoice.data?.[0]) {await rollbackNextSequence(client, "purchaseInvoice", userId);- return redirect(+ throw redirect(path.to.purchaseInvoices,await flash(request,@@ -124,7 +124,7 @@ export async function action({ request }: ActionFunctionArgs) {const invoice = createPurchaseInvoice.data?.[0];- return redirect(path.to.purchaseInvoice(invoice?.id!));+ throw redirect(path.to.purchaseInvoice(invoice?.id!));}export default function PurchaseInvoiceNewRoute() {diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId._index.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId._index.tsxindex a6dbf2ebef..ba3849237f 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId._index.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId._index.tsx@@ -5,5 +5,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { orderId } = params;if (!orderId) throw new Error("Could not find orderId");- return redirect(path.to.purchaseOrderDetails(orderId));+ throw redirect(path.to.purchaseOrderDetails(orderId));}diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsxindex 39c279e3af..6e91c6834d 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsx@@ -35,7 +35,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (purchaseOrderDelivery.error) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request,@@ -48,7 +48,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}if (shippingMethods.error) {- return redirect(+ throw redirect(path.to.purchaseOrders,await flash(request,@@ -58,7 +58,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}if (shippingTerms.error) {- return redirect(+ throw redirect(path.to.purchaseOrders,await flash(request,@@ -102,7 +102,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (updatePurchaseOrderDelivery.error) {- return redirect(+ throw redirect(path.to.purchaseOrderDelivery(orderId),await flash(request,@@ -114,7 +114,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.purchaseOrderDelivery(orderId),await flash(request, success("Updated purchase order delivery")));diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsxindex 5f1003862e..acd148bdf4 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx@@ -43,7 +43,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updatePurchaseOrder.error) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request,@@ -52,7 +52,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request, success("Updated purchase order")));diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsxindex d9e5c731d1..cabe13c8ef 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsx@@ -84,7 +84,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (updatePurchaseOrderLine.error) {- return redirect(+ throw redirect(path.to.purchaseOrderLines(orderId),await flash(request,@@ -96,7 +96,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.purchaseOrderLines(orderId));+ throw redirect(path.to.purchaseOrderLines(orderId));}export default function EditPurchaseOrderLineRoute() {diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.delete.$lineId.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.delete.$lineId.tsxindex b7c86bf169..72ea56ce6f 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.delete.$lineId.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.delete.$lineId.tsx@@ -22,7 +22,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const purchaseOrderLine = await getPurchaseOrderLine(client, lineId);if (purchaseOrderLine.error) {- return redirect(+ throw redirect(path.to.purchaseOrderLines(orderId),await flash(request,@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {lineId);if (deleteTypeError) {- return redirect(+ throw redirect(path.to.purchaseOrderLines(orderId),await flash(request,@@ -57,7 +57,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.purchaseOrderLines(orderId),await flash(request, success("Successfully deleted purchase order line")));diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsxindex 48e64e09d7..3525d1bc01 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsx@@ -42,7 +42,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createPurchaseOrderLine.error) {- return redirect(+ throw redirect(path.to.purchaseOrderLines(orderId),await flash(request,@@ -54,7 +54,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.purchaseOrderLines(orderId));+ throw redirect(path.to.purchaseOrderLines(orderId));}export default function NewPurchaseOrderLineRoute() {diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsxindex 7152309a88..1f52d860d9 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx@@ -30,7 +30,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (purchaseOrderPayment.error) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request,@@ -43,7 +43,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}if (paymentTerms.error) {- return redirect(+ throw redirect(path.to.purchaseOrders,await flash(request,@@ -83,7 +83,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updatePurchaseOrderPayment.error) {- return redirect(+ throw redirect(path.to.purchaseOrderPayment(orderId),await flash(request,@@ -95,7 +95,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.purchaseOrderPayment(orderId),await flash(request, success("Updated purchase order payment")));diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.release.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.release.tsxindex 1abd321545..9164074d22 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.release.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.release.tsx@@ -38,7 +38,7 @@ export async function action(args: ActionFunctionArgs) {const release = await releasePurchaseOrder(client, orderId, userId);if (release.error) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request,@@ -49,7 +49,7 @@ export async function action(args: ActionFunctionArgs) {const purchaseOrder = await getPurchaseOrder(client, orderId);if (purchaseOrder.error) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request,@@ -76,13 +76,13 @@ export async function action(args: ActionFunctionArgs) {});if (fileUpload.error) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request, error(fileUpload.error, "Failed to upload file")));}} catch (err) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request, error(err, "Failed to generate PDF")));@@ -162,7 +162,7 @@ export async function action(args: ActionFunctionArgs) {},});} catch (err) {- return redirect(+ throw redirect(path.to.purchaseOrder(orderId),await flash(request, error(err, "Failed to send email")));@@ -176,7 +176,7 @@ export async function action(args: ActionFunctionArgs) {throw new Error("Invalid notification type");}- return redirect(+ throw redirect(path.to.purchaseOrderExternalDocuments(orderId),await flash(request, success("Purchase order released")));diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.tsxindex 1e5f6776dd..77b4fa160f 100644--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.tsx@@ -46,7 +46,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (purchaseOrder.error) {- return redirect(+ throw redirect(path.to.purchaseOrders,await flash(request,@@ -65,7 +65,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}export async function action({ request }: ActionFunctionArgs) {- return redirect(request.headers.get("Referer") ?? request.url);+ throw redirect(request.headers.get("Referer") ?? request.url);}export default function PurchaseOrderRoute() {diff --git a/apps/carbon/app/routes/x+/purchase-order+/delete.$orderId.tsx b/apps/carbon/app/routes/x+/purchase-order+/delete.$orderId.tsxindex dc8e506362..800f7563fc 100644--- a/apps/carbon/app/routes/x+/purchase-order+/delete.$orderId.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/delete.$orderId.tsx@@ -19,7 +19,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const remove = await deletePurchaseOrder(client, orderId);if (remove.error) {- return redirect(+ throw redirect(path.to.purchaseOrders,await flash(request,@@ -28,5 +28,5 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.purchaseOrders);+ throw redirect(path.to.purchaseOrders);}diff --git a/apps/carbon/app/routes/x+/purchase-order+/new.tsx b/apps/carbon/app/routes/x+/purchase-order+/new.tsxindex cf0a977d23..0a8127c907 100644--- a/apps/carbon/app/routes/x+/purchase-order+/new.tsx+++ b/apps/carbon/app/routes/x+/purchase-order+/new.tsx@@ -35,7 +35,7 @@ export async function action({ request }: ActionFunctionArgs) {const nextSequence = await getNextSequence(client, "purchaseOrder", userId);if (nextSequence.error) {- return redirect(+ throw redirect(path.to.newPurchaseOrder,await flash(request,@@ -54,7 +54,7 @@ export async function action({ request }: ActionFunctionArgs) {if (createPurchaseOrder.error || !createPurchaseOrder.data?.[0]) {// TODO: this should be done as a transactionawait rollbackNextSequence(client, "purchaseOrder", userId);- return redirect(+ throw redirect(path.to.purchaseOrders,await flash(request,@@ -65,7 +65,7 @@ export async function action({ request }: ActionFunctionArgs) {const order = createPurchaseOrder.data?.[0];- return redirect(path.to.purchaseOrder(order.id!));+ throw redirect(path.to.purchaseOrder(order.id!));}export default function PurchaseOrderNewRoute() {diff --git a/apps/carbon/app/routes/x+/purchasing+/_index.tsx b/apps/carbon/app/routes/x+/purchasing+/_index.tsxindex 9eed253c13..9d8c0cc472 100644--- a/apps/carbon/app/routes/x+/purchasing+/_index.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.purchaseOrders);+ throw redirect(path.to.purchaseOrders);}diff --git a/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.$supplierStatusId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.$supplierStatusId.tsxindex 0c03ec6349..4bb531aec7 100644--- a/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.$supplierStatusId.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.$supplierStatusId.tsx@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const supplierStatus = await getSupplierStatus(client, supplierStatusId);if (supplierStatus.error) {- return redirect(+ throw redirect(path.to.supplierStatuses,await flash(request,@@ -76,7 +76,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.supplierStatuses}?${getParams(request)}`,await flash(request, success("Updated supplier status")));diff --git a/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.delete.$supplierStatusId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.delete.$supplierStatusId.tsxindex aeb9f9362e..743080938a 100644--- a/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.delete.$supplierStatusId.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-statuses.delete.$supplierStatusId.tsx@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const supplierStatus = await getSupplierStatus(client, supplierStatusId);if (supplierStatus.error) {- return redirect(+ throw redirect(`${path.to.supplierStatuses}?${getParams(request)}`,await flash(request,@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { supplierStatusId } = params;if (!supplierStatusId) {- return redirect(+ throw redirect(`${path.to.supplierStatuses}?${getParams(request)}`,await flash(request, error(params, "Failed to get an supplier status id")));@@ -49,7 +49,7 @@ export async function action({ request, params }: ActionFunctionArgs) {supplierStatusId);if (deleteStatusError) {- return redirect(+ throw redirect(`${path.to.supplierStatuses}?${getParams(request)}`,await flash(request,@@ -58,7 +58,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.supplierStatuses}?${getParams(request)}`,await flash(request, success("Successfully deleted supplier status")));diff --git a/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsxindex 206ac034a5..067cb1f271 100644--- a/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const supplierType = await getSupplierType(client, supplierTypeId);if (supplierType.error) {- return redirect(+ throw redirect(`${path.to.supplierTypes}?${getParams(request)}`,await flash(request,@@ -36,7 +36,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {);}if (supplierType?.data?.protected) {- return redirect(+ throw redirect(path.to.supplierTypes,await flash(request, error(null, "Cannot edit a protected supplier type")));@@ -80,7 +80,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.supplierTypes}?${getParams(request)}`,await flash(request, success("Updated supplier type")));diff --git a/apps/carbon/app/routes/x+/purchasing+/supplier-types.delete.$supplierTypeId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.delete.$supplierTypeId.tsxindex e7ee0b204c..94ecac070f 100644--- a/apps/carbon/app/routes/x+/purchasing+/supplier-types.delete.$supplierTypeId.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-types.delete.$supplierTypeId.tsx@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const supplierType = await getSupplierType(client, supplierTypeId);if (supplierType.error) {- return redirect(+ throw redirect(path.to.supplierTypes,await flash(request,@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { supplierTypeId } = params;if (!supplierTypeId) {- return redirect(+ throw redirect(`${path.to.supplierTypes}?${getParams(request)}`,await flash(request, error(params, "Failed to get an supplier type id")));@@ -49,7 +49,7 @@ export async function action({ request, params }: ActionFunctionArgs) {supplierTypeId);if (deleteTypeError) {- return redirect(+ throw redirect(`${path.to.supplierTypes}?${getParams(request)}`,await flash(request,@@ -58,7 +58,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.supplierTypes}?${getParams(request)}`,await flash(request, success("Successfully deleted supplier type")));diff --git a/apps/carbon/app/routes/x+/quote+/$id._index.tsx b/apps/carbon/app/routes/x+/quote+/$id._index.tsxindex 0330a46dcf..9214487b2f 100644--- a/apps/carbon/app/routes/x+/quote+/$id._index.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id._index.tsx@@ -5,5 +5,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { id } = params;if (!id) throw new Error("Could not find id");- return redirect(path.to.quoteDetails(id));+ throw redirect(path.to.quoteDetails(id));}diff --git a/apps/carbon/app/routes/x+/quote+/$id.details.tsx b/apps/carbon/app/routes/x+/quote+/$id.details.tsxindex e306e4d651..42478de891 100644--- a/apps/carbon/app/routes/x+/quote+/$id.details.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.details.tsx@@ -44,7 +44,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updateQuotation.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request,@@ -53,7 +53,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.quote(id),await flash(request, success("Updated quote")));diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsxindex cda0eac7d6..9c76c97a12 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsx@@ -34,7 +34,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.quoteLine(quoteId, quoteLineId));+ throw redirect(path.to.quoteLine(quoteId, quoteLineId));}export default function DeleteQuoteAssembly() {diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsxindex 21b668ef73..0e31f5b309 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const assembly = await getQuoteAssembly(client, assemblyId);if (assembly.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request,@@ -81,7 +81,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.quoteAssembly(quoteId, quoteLineId, assemblyId));+ throw redirect(path.to.quoteAssembly(quoteId, quoteLineId, assemblyId));}export default function QuoteAssembly() {diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsxindex 9b267d9fdd..a5af7c70a5 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsx@@ -44,7 +44,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createQuotationAssembly.error) {- return redirect(+ throw redirect(path.to.newQuoteAssembly(quoteId, quoteLineId),await flash(request,@@ -55,7 +55,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const assemblyId = createQuotationAssembly.data.id;if (assemblyId) {- return redirect(path.to.quoteAssembly(quoteId, quoteLineId, assemblyId));+ throw redirect(path.to.quoteAssembly(quoteId, quoteLineId, assemblyId));}}diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsxindex 2a40fd80cb..8d0551c7fa 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsx@@ -33,7 +33,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.quote(quoteId));+ throw redirect(path.to.quote(quoteId));}export default function DeleteQuoteLine() {diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsxindex 5789e8a29e..f902852000 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx@@ -71,7 +71,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (updateQuotationLine.error) {- return redirect(+ throw redirect(path.to.quoteLine(quoteId, lineId),await flash(request,@@ -96,7 +96,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (updateLinePrice.error) {- return redirect(+ throw redirect(path.to.quoteLine(quoteId, lineId),await flash(request,@@ -106,7 +106,7 @@ export async function action({ request, params }: ActionFunctionArgs) {}}- return redirect(path.to.quoteLine(quoteId, lineId));+ throw redirect(path.to.quoteLine(quoteId, lineId));}export default function EditQuotationLineRoute() {diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsxindex b599b64111..6339dbecd7 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsx@@ -34,7 +34,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.quoteLine(quoteId, quoteLineId));+ throw redirect(path.to.quoteLine(quoteId, quoteLineId));}export default function DeleteQuoteOperation() {diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsxindex e594d6a3e1..0cc8f62c33 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsx@@ -59,7 +59,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.quoteOperation(quoteId, quoteLineId, quoteOperationId));}diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.tsxindex a76e218736..736f8963a9 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.tsx@@ -31,7 +31,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {getQuoteMaterialsByOperation(client, operationId),]);if (operation.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request,@@ -41,7 +41,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}if (materials.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request,@@ -100,7 +100,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.quoteOperation(quoteId, quoteLineId, operationId));+ throw redirect(path.to.quoteOperation(quoteId, quoteLineId, operationId));}export default function QuoteOperation() {diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.new.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.new.tsxindex 8f25671057..fbf7da21ab 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.new.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.new.tsx@@ -45,7 +45,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createQuotationOperation.error) {- return redirect(+ throw redirect(path.to.newQuoteOperation(quoteId, quoteLineId),await flash(request,@@ -59,7 +59,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const operationId = createQuotationOperation.data.id;if (operationId) {- return redirect(path.to.quoteOperation(quoteId, quoteLineId, operationId));+ throw redirect(path.to.quoteOperation(quoteId, quoteLineId, operationId));}}diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsxindex 5eb287b50d..d0f95383f4 100644--- a/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsx@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const quotationLine = await getQuoteLine(client, lineId);if (quotationLine.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request,@@ -42,7 +42,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteTypeError } = await deleteQuoteLine(client, lineId);if (deleteTypeError) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request,@@ -51,7 +51,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.quote(id),await flash(request, success("Successfully deleted quotation line")));diff --git a/apps/carbon/app/routes/x+/quote+/$id.new.tsx b/apps/carbon/app/routes/x+/quote+/$id.new.tsxindex 0128b3969a..ee67bd2554 100644--- a/apps/carbon/app/routes/x+/quote+/$id.new.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.new.tsx@@ -40,7 +40,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createQuotationLine.error) {- return redirect(+ throw redirect(path.to.quote(quoteId),await flash(request,@@ -59,7 +59,7 @@ export async function action({ request, params }: ActionFunctionArgs) {createdBy: userId,});- return redirect(path.to.quoteLine(quoteId, quoteLineId));+ throw redirect(path.to.quoteLine(quoteId, quoteLineId));}export default function NewQuotationLineRoute() {diff --git a/apps/carbon/app/routes/x+/quote+/$id.release.tsx b/apps/carbon/app/routes/x+/quote+/$id.release.tsxindex d306e6a941..37d6e185dc 100644--- a/apps/carbon/app/routes/x+/quote+/$id.release.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.release.tsx@@ -38,7 +38,7 @@ export async function action(args: ActionFunctionArgs) {const release = await releaseQuote(client, id, userId);if (release.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request, error(release.error, "Failed to release quote")));@@ -46,7 +46,7 @@ export async function action(args: ActionFunctionArgs) {const quote = await getQuote(client, id);if (quote.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request, error(quote.error, "Failed to get quote")));@@ -70,13 +70,13 @@ export async function action(args: ActionFunctionArgs) {});if (fileUpload.error) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request, error(fileUpload.error, "Failed to upload file")));}} catch (err) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request, error(err, "Failed to generate PDF")));@@ -146,7 +146,7 @@ export async function action(args: ActionFunctionArgs) {},});} catch (err) {- return redirect(+ throw redirect(path.to.quote(id),await flash(request, error(err, "Failed to send email")));@@ -160,7 +160,7 @@ export async function action(args: ActionFunctionArgs) {throw new Error("Invalid notification type");}- return redirect(+ throw redirect(path.to.quote(id),await flash(request, success("Quote released")));diff --git a/apps/carbon/app/routes/x+/quote+/$id.tsx b/apps/carbon/app/routes/x+/quote+/$id.tsxindex cb7246f32a..1436391ab8 100644--- a/apps/carbon/app/routes/x+/quote+/$id.tsx+++ b/apps/carbon/app/routes/x+/quote+/$id.tsx@@ -74,7 +74,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (quotation.error) {- return redirect(+ throw redirect(path.to.quotes,await flash(request,@@ -96,7 +96,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {}export async function action({ request }: ActionFunctionArgs) {- return redirect(request.headers.get("Referer") ?? request.url);+ throw redirect(request.headers.get("Referer") ?? request.url);}export default function QuotationRoute() {diff --git a/apps/carbon/app/routes/x+/quote+/delete.$id.tsx b/apps/carbon/app/routes/x+/quote+/delete.$id.tsxindex 159ad5e54d..d333321518 100644--- a/apps/carbon/app/routes/x+/quote+/delete.$id.tsx+++ b/apps/carbon/app/routes/x+/quote+/delete.$id.tsx@@ -19,11 +19,11 @@ export async function action({ request, params }: ActionFunctionArgs) {const remove = await deleteQuote(client, id);if (remove.error) {- return redirect(+ throw redirect(path.to.quotes,await flash(request, error(remove.error, "Failed to delete quote")));}- return redirect(path.to.quotes);+ throw redirect(path.to.quotes);}diff --git a/apps/carbon/app/routes/x+/quote+/new.tsx b/apps/carbon/app/routes/x+/quote+/new.tsxindex 99039b7460..03a2e3972d 100644--- a/apps/carbon/app/routes/x+/quote+/new.tsx+++ b/apps/carbon/app/routes/x+/quote+/new.tsx@@ -30,7 +30,7 @@ export async function action({ request }: ActionFunctionArgs) {const nextSequence = await getNextSequence(client, "quote", userId);if (nextSequence.error) {- return redirect(+ throw redirect(path.to.newQuote,await flash(request,@@ -49,7 +49,7 @@ export async function action({ request }: ActionFunctionArgs) {if (createQuotation.error || !createQuotation.data?.[0]) {// TODO: this should be done as a transactionawait rollbackNextSequence(client, "quote", userId);- return redirect(+ throw redirect(path.to.quotes,await flash(request,@@ -60,7 +60,7 @@ export async function action({ request }: ActionFunctionArgs) {const order = createQuotation.data?.[0];- return redirect(path.to.quote(order.id!));+ throw redirect(path.to.quote(order.id!));}export default function QuotationNewRoute() {diff --git a/apps/carbon/app/routes/x+/resources+/_index.tsx b/apps/carbon/app/routes/x+/resources+/_index.tsxindex ec8572ee5a..e9d928df18 100644--- a/apps/carbon/app/routes/x+/resources+/_index.tsx+++ b/apps/carbon/app/routes/x+/resources+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.people);+ throw redirect(path.to.people);}diff --git a/apps/carbon/app/routes/x+/resources+/abilities.delete.$abilityId.tsx b/apps/carbon/app/routes/x+/resources+/abilities.delete.$abilityId.tsxindex e9991e279e..1f9e59e8b3 100644--- a/apps/carbon/app/routes/x+/resources+/abilities.delete.$abilityId.tsx+++ b/apps/carbon/app/routes/x+/resources+/abilities.delete.$abilityId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const ability = await getAbility(client, abilityId);if (ability.error) {- return redirect(+ throw redirect(path.to.abilities,await flash(request, error(ability.error, "Failed to get ability")));@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { abilityId } = params;if (!abilityId) {- return redirect(+ throw redirect(path.to.abilities,await flash(request, error(params, "Failed to get ability id")));@@ -46,7 +46,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteAbilityError } = await deleteAbility(client, abilityId);if (deleteAbilityError) {- return redirect(+ throw redirect(path.to.abilities,await flash(request,@@ -55,7 +55,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.abilities,await flash(request, success("Successfully deleted employee type")));diff --git a/apps/carbon/app/routes/x+/resources+/abilities.new.tsx b/apps/carbon/app/routes/x+/resources+/abilities.new.tsxindex e6aeced74c..f119a58ff4 100644--- a/apps/carbon/app/routes/x+/resources+/abilities.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/abilities.new.tsx@@ -100,7 +100,7 @@ export async function action({ request }: ActionFunctionArgs) {}}- return redirect(+ throw redirect(path.to.abilities,await flash(request, success(`Ability created`)));diff --git a/apps/carbon/app/routes/x+/resources+/abilities.tsx b/apps/carbon/app/routes/x+/resources+/abilities.tsxindex 3d7059021b..f8c2ed879e 100644--- a/apps/carbon/app/routes/x+/resources+/abilities.tsx+++ b/apps/carbon/app/routes/x+/resources+/abilities.tsx@@ -36,7 +36,7 @@ export async function loader({ request }: LoaderFunctionArgs) {});if (abilities.error) {- return redirect(+ throw redirect(path.to.resources,await flash(request, error(abilities.error, "Failed to load abilities")));diff --git a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsxindex e91b2632d3..2ca81b7b98 100644--- a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx+++ b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx@@ -74,7 +74,7 @@ export async function action({ params, request }: ActionFunctionArgs) {});if (updateEmployeeAbility.error) {- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request,@@ -86,7 +86,7 @@ export async function action({ params, request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request, success("Employee ability updated")));diff --git a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.delete.$id.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.delete.$id.tsxindex 4e50e00a27..a080fce66d 100644--- a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.delete.$id.tsx+++ b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.delete.$id.tsx@@ -21,7 +21,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const removeEmployeeAbility = await deleteEmployeeAbility(client, id);if (removeEmployeeAbility.error) {- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request,@@ -30,7 +30,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request, success("Successfully deleted employee ability")));diff --git a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsxindex c68c981c15..f2b45e2a15 100644--- a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx@@ -41,7 +41,7 @@ export async function action({ params, request }: ActionFunctionArgs) {});if (insertEmployeeAbility.error) {- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request,@@ -53,7 +53,7 @@ export async function action({ params, request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request, success("Employee ability created")));diff --git a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.tsxindex ff501a72ff..8142428632 100644--- a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.tsx+++ b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.tsx@@ -51,7 +51,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const { abilityId } = params;if (!abilityId) {- return redirect(+ throw redirect(path.to.abilities,await flash(request, error(null, "Ability ID not found")));@@ -59,7 +59,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const ability = await getAbility(client, abilityId);if (ability.error || !ability.data) {- return redirect(+ throw redirect(path.to.abilities,await flash(request, error(ability.error, "Failed to load ability")));@@ -96,7 +96,7 @@ export async function action({ request, params }: ActionFunctionArgs) {name,});if (updateAbilityName.error) {- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request,@@ -122,7 +122,7 @@ export async function action({ request, params }: ActionFunctionArgs) {shadowWeeks,});if (updateAbilityCurve.error) {- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request,@@ -132,7 +132,7 @@ export async function action({ request, params }: ActionFunctionArgs) {}}- return redirect(+ throw redirect(path.to.ability(abilityId),await flash(request, success("Ability updated")));diff --git a/apps/carbon/app/routes/x+/resources+/attribute.$attributeId.tsx b/apps/carbon/app/routes/x+/resources+/attribute.$attributeId.tsxindex 8dc7231dc2..670f15c7f9 100644--- a/apps/carbon/app/routes/x+/resources+/attribute.$attributeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/attribute.$attributeId.tsx@@ -32,7 +32,7 @@ export async function action({ request, params }: ActionFunctionArgs) {await flash(request, error(update.error, "Failed to update attribute")));- return redirect(+ throw redirect(path.to.attributeCategoryList(validation.data.userAttributeCategoryId),await flash(request, success("Successfully updated attribtue")));diff --git a/apps/carbon/app/routes/x+/resources+/attribute.delete.$attributeId.tsx b/apps/carbon/app/routes/x+/resources+/attribute.delete.$attributeId.tsxindex c2b7ce43f9..906967ffd1 100644--- a/apps/carbon/app/routes/x+/resources+/attribute.delete.$attributeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/attribute.delete.$attributeId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const { attributeId } = params;if (!attributeId) {- return redirect(+ throw redirect(path.to.attributes,await flash(request, error(params, "Failed to get an attribute id")));@@ -21,7 +21,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const deactivateAttribute = await deleteAttribute(client, attributeId);if (deactivateAttribute.error) {- return redirect(+ throw redirect(path.to.attributes,await flash(request,@@ -30,7 +30,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {);}- return redirect(+ throw redirect(path.to.attributes,await flash(request, success("Successfully deactivated attribute")));diff --git a/apps/carbon/app/routes/x+/resources+/attribute.new.tsx b/apps/carbon/app/routes/x+/resources+/attribute.new.tsxindex ab6962eaae..ba86b16259 100644--- a/apps/carbon/app/routes/x+/resources+/attribute.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/attribute.new.tsx@@ -48,5 +48,5 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(path.to.attributeCategoryList(userAttributeCategoryId));+ throw redirect(path.to.attributeCategoryList(userAttributeCategoryId));}diff --git a/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsxindex c5ec34b6f0..f0b06bd600 100644--- a/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx+++ b/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx@@ -25,7 +25,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const attributeCategory = await getAttributeCategory(client, categoryId);if (attributeCategory.error) {- return redirect(+ throw redirect(path.to.attributes,await flash(request,@@ -61,7 +61,7 @@ export async function action({ request }: ActionFunctionArgs) {updatedBy: userId,});if (updateCategory.error) {- return redirect(+ throw redirect(path.to.attributes,await flash(request,@@ -70,7 +70,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.attributes,await flash(request, success("Updated attribute category ")));diff --git a/apps/carbon/app/routes/x+/resources+/attributes.delete.$categoryId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.delete.$categoryId.tsxindex 27d18fac4e..5ec8c5a06b 100644--- a/apps/carbon/app/routes/x+/resources+/attributes.delete.$categoryId.tsx+++ b/apps/carbon/app/routes/x+/resources+/attributes.delete.$categoryId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const { categoryId } = params;if (!categoryId) {- return redirect(+ throw redirect(path.to.attributes,await flash(request, error(params, "Failed to get a category id")));@@ -21,7 +21,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const deactivateAttribute = await deleteAttributeCategory(client, categoryId);if (deactivateAttribute.error) {- return redirect(+ throw redirect(path.to.attributes,await flash(request,@@ -33,7 +33,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {);}- return redirect(+ throw redirect(path.to.attributes,await flash(request, success("Successfully deactivated attribute category")));diff --git a/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsxindex 4f22be78d6..5eb4326e6b 100644--- a/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx@@ -22,7 +22,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const attribute = await getAttribute(client, attributeId);if (attribute.error) {- return redirect(+ throw redirect(path.to.attributeCategoryList(categoryId),await flash(request, error(attribute.error, "Failed to fetch attribute")));diff --git a/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.tsxindex df8b946448..5155925a23 100644--- a/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.tsx+++ b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.tsx@@ -24,7 +24,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const attributeCategory = await getAttributeCategory(client, categoryId);if (attributeCategory.error) {- return redirect(+ throw redirect(path.to.attributes,await flash(request,diff --git a/apps/carbon/app/routes/x+/resources+/attributes.new.tsx b/apps/carbon/app/routes/x+/resources+/attributes.new.tsxindex 24a58293db..ecef36f7ec 100644--- a/apps/carbon/app/routes/x+/resources+/attributes.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/attributes.new.tsx@@ -35,7 +35,7 @@ export async function action({ request }: ActionFunctionArgs) {createdBy: userId,});if (createAttributeCategory.error) {- return redirect(+ throw redirect(path.to.attributes,await flash(request,@@ -47,7 +47,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(path.to.attributes);+ throw redirect(path.to.attributes);}export default function NewAttributeCategoryRoute() {diff --git a/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsx b/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsxindex bd7cff55f3..3378ab3ee3 100644--- a/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsx+++ b/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const contractor = await getContractor(client, supplierContactId);if (contractor.error) {- return redirect(+ throw redirect(path.to.contractors,await flash(request, error(contractor.error, "Failed to get contractor")));@@ -62,7 +62,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (updateContractor.error) {- return redirect(+ throw redirect(path.to.contractors,await flash(request,@@ -71,7 +71,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.contractors,await flash(request, success("Contractor updated")));diff --git a/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsx b/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsxindex fe83c7267a..9b5e80a3f0 100644--- a/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsx+++ b/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const contractor = await getContractor(client, supplierId);if (contractor.error) {- return redirect(+ throw redirect(path.to.contractors,await flash(request, error(contractor.error, "Failed to get contractor")));@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { supplierId } = params;if (!supplierId) {- return redirect(+ throw redirect(path.to.contractors,await flash(request, error(params, "Failed to get contractor id")));@@ -49,7 +49,7 @@ export async function action({ request, params }: ActionFunctionArgs) {supplierId);if (deleteContractorError) {- return redirect(+ throw redirect(path.to.contractors,await flash(request,@@ -58,7 +58,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.contractors,await flash(request, success("Successfully deleted contractor")));diff --git a/apps/carbon/app/routes/x+/resources+/contractors.new.tsx b/apps/carbon/app/routes/x+/resources+/contractors.new.tsxindex c7028dc1fb..c2e9e958b9 100644--- a/apps/carbon/app/routes/x+/resources+/contractors.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/contractors.new.tsx@@ -38,7 +38,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (createContractor.error) {- return redirect(+ throw redirect(path.to.contractors,await flash(request,@@ -47,7 +47,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.contractors,await flash(request, success("Contractor created")));diff --git a/apps/carbon/app/routes/x+/resources+/contractors.tsx b/apps/carbon/app/routes/x+/resources+/contractors.tsxindex 0aaddf72d6..aa86f2e480 100644--- a/apps/carbon/app/routes/x+/resources+/contractors.tsx+++ b/apps/carbon/app/routes/x+/resources+/contractors.tsx@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (contractors.error) {- return redirect(+ throw redirect(path.to.resources,await flash(request,diff --git a/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsx b/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsxindex c957694137..b8bbab0d06 100644--- a/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsx+++ b/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const department = await getDepartment(client, departmentId);if (department.error) {- return redirect(+ throw redirect(path.to.departments,await flash(request, error(department.error, "Failed to get department")));@@ -61,7 +61,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (updateDepartment.error) {- return redirect(+ throw redirect(path.to.departments,await flash(request,@@ -70,7 +70,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.departments,await flash(request, success("Department updated.")));diff --git a/apps/carbon/app/routes/x+/resources+/departments.delete.$departmentId.tsx b/apps/carbon/app/routes/x+/resources+/departments.delete.$departmentId.tsxindex 7ab6f61531..6880c931b7 100644--- a/apps/carbon/app/routes/x+/resources+/departments.delete.$departmentId.tsx+++ b/apps/carbon/app/routes/x+/resources+/departments.delete.$departmentId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const department = await getDepartment(client, departmentId);if (department.error) {- return redirect(+ throw redirect(path.to.departments,await flash(request, error(department.error, "Failed to get department")));@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { departmentId } = params;if (!departmentId) {- return redirect(+ throw redirect(path.to.departments,await flash(request, error(params, "Failed to get department id")));@@ -49,7 +49,7 @@ export async function action({ request, params }: ActionFunctionArgs) {departmentId);if (deleteDepartmentError) {- return redirect(+ throw redirect(path.to.departments,await flash(request,@@ -58,7 +58,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.departments,await flash(request, success("Successfully deleted department")));diff --git a/apps/carbon/app/routes/x+/resources+/departments.tsx b/apps/carbon/app/routes/x+/resources+/departments.tsxindex 56ec2b9ac7..bb151f0da3 100644--- a/apps/carbon/app/routes/x+/resources+/departments.tsx+++ b/apps/carbon/app/routes/x+/resources+/departments.tsx@@ -36,7 +36,7 @@ export async function loader({ request }: LoaderFunctionArgs) {});if (departments.error) {- return redirect(+ throw redirect(path.to.resources,await flash(request,diff --git a/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsxindex ac2f7eaf45..7c145a7f14 100644--- a/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const equipmentType = await getEquipmentType(client, typeId);if (equipmentType.error) {- return redirect(+ throw redirect(path.to.equipment,await flash(request,@@ -61,7 +61,7 @@ export async function action({ request }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updateCategory.error) {- return redirect(+ throw redirect(path.to.equipment,await flash(request,@@ -70,7 +70,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.equipment,await flash(request, success("Updated equipment type ")));diff --git a/apps/carbon/app/routes/x+/resources+/equipment.delete.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.delete.$typeId.tsxindex 5733c90416..8d0c6e6d2a 100644--- a/apps/carbon/app/routes/x+/resources+/equipment.delete.$typeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/equipment.delete.$typeId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const { typeId } = params;if (!typeId) {- return redirect(+ throw redirect(path.to.equipment,await flash(request, error(params, "Failed to get a equipment type id")));@@ -21,7 +21,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const deactivateEquipmentType = await deleteEquipmentType(client, typeId);if (deactivateEquipmentType.error) {- return redirect(+ throw redirect(path.to.equipment,await flash(request,@@ -33,7 +33,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {);}- return redirect(+ throw redirect(path.to.equipment,await flash(request, success("Successfully deactivated equipment type")));diff --git a/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsxindex 333d82d71b..2dc43b662d 100644--- a/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsx+++ b/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsx@@ -23,7 +23,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const equipment = await getEquipment(client, equipmentId);if (equipment.error) {- return redirect(+ throw redirect(path.to.equipmentTypeList(typeId),await flash(request, error(equipment.error, "Failed to fetch equipment")));diff --git a/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.tsxindex c6e3ea5cdf..75a6846134 100644--- a/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const equipmentType = await getEquipmentType(client, typeId);if (equipmentType.error) {- return redirect(+ throw redirect(path.to.equipment,await flash(request,diff --git a/apps/carbon/app/routes/x+/resources+/equipment.unit.$equipmentId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.unit.$equipmentId.tsxindex a6b83c4a66..5d88994ccf 100644--- a/apps/carbon/app/routes/x+/resources+/equipment.unit.$equipmentId.tsx+++ b/apps/carbon/app/routes/x+/resources+/equipment.unit.$equipmentId.tsx@@ -24,7 +24,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { equipmentId } = params;if (!equipmentId) {- return redirect(+ throw redirect(path.to.equipment,await flash(request,@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {));- return redirect(+ throw redirect(path.to.equipmentTypeList(validation.data.equipmentTypeId),await flash(request, success("Successfully updated equipment")));diff --git a/apps/carbon/app/routes/x+/resources+/equipment.unit.delete.$equipmentId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.unit.delete.$equipmentId.tsxindex 8b78db0b39..a25abbba66 100644--- a/apps/carbon/app/routes/x+/resources+/equipment.unit.delete.$equipmentId.tsx+++ b/apps/carbon/app/routes/x+/resources+/equipment.unit.delete.$equipmentId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: ActionFunctionArgs) {const equipment = await getEquipment(client, equipmentId);if (equipment.error) {- return redirect(+ throw redirect(path.to.equipment,await flash(request, error(equipment.error, "Failed to get equipment")));@@ -39,7 +39,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const deactivateEquipment = await deleteEquipment(client, equipmentId);if (deactivateEquipment.error) {- return redirect(+ throw redirect(path.to.equipment,await flash(request,@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.equipment,await flash(request, success("Successfully deleted equipment")));diff --git a/apps/carbon/app/routes/x+/resources+/equipment.unit.new.tsx b/apps/carbon/app/routes/x+/resources+/equipment.unit.new.tsxindex 908d42a70e..75d83bdbf2 100644--- a/apps/carbon/app/routes/x+/resources+/equipment.unit.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/equipment.unit.new.tsx@@ -39,5 +39,5 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(path.to.equipment);+ throw redirect(path.to.equipment);}diff --git a/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsx b/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsxindex 32c341851b..9343122da3 100644--- a/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsx+++ b/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const holiday = await getHoliday(client, holidayId);if (holiday.error) {- return redirect(+ throw redirect(path.to.holidays,await flash(request, error(holiday.error, "Failed to get holiday")));@@ -61,7 +61,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (updateHoliday.error) {- return redirect(+ throw redirect(path.to.holidays,await flash(request,@@ -70,7 +70,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.holidays,await flash(request, success("Holiday updated.")));diff --git a/apps/carbon/app/routes/x+/resources+/holidays.delete.$holidayId.tsx b/apps/carbon/app/routes/x+/resources+/holidays.delete.$holidayId.tsxindex 33820ad476..4a3e65bf56 100644--- a/apps/carbon/app/routes/x+/resources+/holidays.delete.$holidayId.tsx+++ b/apps/carbon/app/routes/x+/resources+/holidays.delete.$holidayId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const holiday = await getHoliday(client, holidayId);if (holiday.error) {- return redirect(+ throw redirect(path.to.holidays,await flash(request, error(holiday.error, "Failed to get holiday")));@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { holidayId } = params;if (!holidayId) {- return redirect(+ throw redirect(path.to.holidays,await flash(request, error(params, "Failed to get holiday id")));@@ -46,7 +46,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteHolidayError } = await deleteHoliday(client, holidayId);if (deleteHolidayError) {- return redirect(+ throw redirect(path.to.holidays,await flash(request,@@ -55,7 +55,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.holidays,await flash(request, success("Successfully deleted holiday")));diff --git a/apps/carbon/app/routes/x+/resources+/holidays.new.tsx b/apps/carbon/app/routes/x+/resources+/holidays.new.tsxindex 07d3f1efb8..e0a48b9a08 100644--- a/apps/carbon/app/routes/x+/resources+/holidays.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/holidays.new.tsx@@ -36,7 +36,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (createHoliday.error) {- return redirect(+ throw redirect(path.to.holidays,await flash(request,@@ -45,7 +45,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.holidays,await flash(request, success("Holiday created.")));diff --git a/apps/carbon/app/routes/x+/resources+/holidays.tsx b/apps/carbon/app/routes/x+/resources+/holidays.tsxindex 086cb3d75d..df8b1767f7 100644--- a/apps/carbon/app/routes/x+/resources+/holidays.tsx+++ b/apps/carbon/app/routes/x+/resources+/holidays.tsx@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (holidays.error) {- return redirect(+ throw redirect(path.to.resources,await flash(request, error(holidays.error, "Failed to load holidays")));diff --git a/apps/carbon/app/routes/x+/resources+/locations.$locationId.tsx b/apps/carbon/app/routes/x+/resources+/locations.$locationId.tsxindex f4772e9669..2e617e51eb 100644--- a/apps/carbon/app/routes/x+/resources+/locations.$locationId.tsx+++ b/apps/carbon/app/routes/x+/resources+/locations.$locationId.tsx@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const location = await getLocation(client, locationId);if (location.error) {- return redirect(+ throw redirect(path.to.locations,await flash(request, error(location.error, "Failed to get location")));@@ -62,7 +62,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (createLocation.error) {- return redirect(+ throw redirect(path.to.locations,await flash(request,@@ -71,7 +71,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.locations,await flash(request, success("Location updated.")));diff --git a/apps/carbon/app/routes/x+/resources+/locations.delete.$locationId.tsx b/apps/carbon/app/routes/x+/resources+/locations.delete.$locationId.tsxindex 4a84b627b6..72972bb97e 100644--- a/apps/carbon/app/routes/x+/resources+/locations.delete.$locationId.tsx+++ b/apps/carbon/app/routes/x+/resources+/locations.delete.$locationId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const location = await getLocation(client, locationId);if (location.error) {- return redirect(+ throw redirect(path.to.locations,await flash(request, error(location.error, "Failed to get location")));@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { locationId } = params;if (!locationId) {- return redirect(+ throw redirect(path.to.locations,await flash(request, error(params, "Failed to get location id")));@@ -49,7 +49,7 @@ export async function action({ request, params }: ActionFunctionArgs) {locationId);if (deleteLocationError) {- return redirect(+ throw redirect(path.to.locations,await flash(request,@@ -58,7 +58,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.locations,await flash(request, success("Successfully deleted location")));diff --git a/apps/carbon/app/routes/x+/resources+/locations.tsx b/apps/carbon/app/routes/x+/resources+/locations.tsxindex ce6dfd4462..339827ae31 100644--- a/apps/carbon/app/routes/x+/resources+/locations.tsx+++ b/apps/carbon/app/routes/x+/resources+/locations.tsx@@ -36,7 +36,7 @@ export async function loader({ request }: LoaderFunctionArgs) {});if (locations.error) {- return redirect(+ throw redirect(path.to.resources,await flash(request, error(locations.error, "Failed to load locations")));diff --git a/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsx b/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsxindex 3d8a2aa6ce..2efe836fd7 100644--- a/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsx+++ b/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsx@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const partner = await getPartner(client, supplierLocationId, abilityId);if (partner.error) {- return redirect(+ throw redirect(path.to.partners,await flash(request, error(partner.error, "Failed to get partner")));@@ -60,7 +60,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (updatePartner.error) {- return redirect(+ throw redirect(path.to.partners,await flash(request,@@ -69,7 +69,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partners,await flash(request, success("Partner updated.")));diff --git a/apps/carbon/app/routes/x+/resources+/partners.delete.$supplierId.tsx b/apps/carbon/app/routes/x+/resources+/partners.delete.$supplierId.tsxindex b132b6967b..40a229783b 100644--- a/apps/carbon/app/routes/x+/resources+/partners.delete.$supplierId.tsx+++ b/apps/carbon/app/routes/x+/resources+/partners.delete.$supplierId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const partner = await getPartnerBySupplierId(client, supplierId);if (partner.error) {- return redirect(+ throw redirect(path.to.partners,await flash(request, error(partner.error, "Failed to get partner")));@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { supplierId } = params;if (!supplierId) {- return redirect(+ throw redirect(path.to.partners,await flash(request, error(params, "Failed to get partner id")));@@ -46,7 +46,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deletePartnerError } = await deletePartner(client, supplierId);if (deletePartnerError) {- return redirect(+ throw redirect(path.to.partners,await flash(request,@@ -55,7 +55,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partners,await flash(request, success("Successfully deleted partner")));diff --git a/apps/carbon/app/routes/x+/resources+/partners.new.tsx b/apps/carbon/app/routes/x+/resources+/partners.new.tsxindex f901c4b951..bb02ebf3b1 100644--- a/apps/carbon/app/routes/x+/resources+/partners.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/partners.new.tsx@@ -36,7 +36,7 @@ export async function action({ request }: ActionFunctionArgs) {});if (createPartner.error) {- return redirect(+ throw redirect(path.to.partners,await flash(request,@@ -45,7 +45,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.partners,await flash(request, success("Partner created.")));diff --git a/apps/carbon/app/routes/x+/resources+/partners.tsx b/apps/carbon/app/routes/x+/resources+/partners.tsxindex 3f01a0cff7..77a664ae4a 100644--- a/apps/carbon/app/routes/x+/resources+/partners.tsx+++ b/apps/carbon/app/routes/x+/resources+/partners.tsx@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (partners.error) {- return redirect(+ throw redirect(path.to.resources,await flash(request, error(partners.error, "Failed to load partners")));diff --git a/apps/carbon/app/routes/x+/resources+/people.tsx b/apps/carbon/app/routes/x+/resources+/people.tsxindex 29c0abb0e8..ac7df1e8ff 100644--- a/apps/carbon/app/routes/x+/resources+/people.tsx+++ b/apps/carbon/app/routes/x+/resources+/people.tsx@@ -39,7 +39,7 @@ export async function loader({ request }: LoaderFunctionArgs) {getPeople(client, { search, limit, offset, sorts, filters }),]);if (attributeCategories.error) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request,@@ -48,7 +48,7 @@ export async function loader({ request }: LoaderFunctionArgs) {);}if (employeeTypes.error) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request,@@ -57,7 +57,7 @@ export async function loader({ request }: LoaderFunctionArgs) {);}if (people.error) {- return redirect(+ throw redirect(path.to.authenticatedRoot,await flash(request, error(people.error, "Error loading people")));diff --git a/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx b/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsxindex 758d45c410..0db7c075cf 100644--- a/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx+++ b/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const shift = await getShift(client, shiftId);if (shift.error) {- return redirect(+ throw redirect(path.to.shifts,await flash(request, error(shift.error, "Failed to get shift")));@@ -61,13 +61,13 @@ export async function action({ request }: ActionFunctionArgs) {});if (createShift.error) {- return redirect(+ throw redirect(path.to.shifts,await flash(request, error(createShift.error, "Failed to create shift")));}- return redirect(+ throw redirect(path.to.shifts,await flash(request, success("Shift updated")));diff --git a/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx b/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsxindex 21b231b646..69f9d1ba2b 100644--- a/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx+++ b/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const shift = await getShift(client, shiftId);if (shift.error) {- return redirect(+ throw redirect(path.to.shifts,await flash(request, error(shift.error, "Failed to get shift")));@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { shiftId } = params;if (!shiftId) {- return redirect(+ throw redirect(path.to.shifts,await flash(request, error(params, "Failed to get shift id")));@@ -46,13 +46,13 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteShiftError } = await deleteShift(client, shiftId);if (deleteShiftError) {- return redirect(+ throw redirect(path.to.shifts,await flash(request, error(deleteShiftError, "Failed to delete shift")));}- return redirect(+ throw redirect(path.to.shifts,await flash(request, success("Successfully deleted shift")));diff --git a/apps/carbon/app/routes/x+/resources+/shifts.new.tsx b/apps/carbon/app/routes/x+/resources+/shifts.new.tsxindex e597b0f9d8..debb22ee89 100644--- a/apps/carbon/app/routes/x+/resources+/shifts.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/shifts.new.tsx@@ -31,13 +31,13 @@ export async function action({ request }: ActionFunctionArgs) {});if (createShift.error) {- return redirect(+ throw redirect(path.to.shifts,await flash(request, error(createShift.error, "Failed to create shift.")));}- return redirect(+ throw redirect(path.to.shifts,await flash(request, success("Shift created.")));diff --git a/apps/carbon/app/routes/x+/resources+/shifts.tsx b/apps/carbon/app/routes/x+/resources+/shifts.tsxindex 9087abd82f..a6879c8cc2 100644--- a/apps/carbon/app/routes/x+/resources+/shifts.tsx+++ b/apps/carbon/app/routes/x+/resources+/shifts.tsx@@ -33,7 +33,7 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (shifts.error) {- return redirect(+ throw redirect(path.to.resources,await flash(request, error(shifts.error, "Failed to load shifts")));diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsxindex 93e64ace10..fe76d6c337 100644--- a/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const workCellType = await getWorkCellType(client, typeId);if (workCellType.error) {- return redirect(+ throw redirect(path.to.workCells,await flash(request,@@ -61,7 +61,7 @@ export async function action({ request }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (updateCategory.error) {- return redirect(+ throw redirect(path.to.workCells,await flash(request,@@ -70,7 +70,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.workCells,await flash(request, success("Updated work cell type ")));diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.cell.$workCellId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.cell.$workCellId.tsxindex b46cf8cc46..ea43b9914c 100644--- a/apps/carbon/app/routes/x+/resources+/work-cells.cell.$workCellId.tsx+++ b/apps/carbon/app/routes/x+/resources+/work-cells.cell.$workCellId.tsx@@ -24,7 +24,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { workCellId } = params;if (!workCellId) {- return redirect(+ throw redirect(path.to.workCells,await flash(request,@@ -50,7 +50,7 @@ export async function action({ request, params }: ActionFunctionArgs) {));- return redirect(+ throw redirect(path.to.workCellTypeList(validation.data.workCellTypeId),await flash(request, success("Successfully updated workCell")));diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.cell.delete.$workCellId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.cell.delete.$workCellId.tsxindex 035aa63013..2792e127cf 100644--- a/apps/carbon/app/routes/x+/resources+/work-cells.cell.delete.$workCellId.tsx+++ b/apps/carbon/app/routes/x+/resources+/work-cells.cell.delete.$workCellId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: ActionFunctionArgs) {const workCell = await getWorkCell(client, workCellId);if (workCell.error) {- return redirect(+ throw redirect(path.to.workCells,await flash(request, error(workCell.error, "Failed to get work cell")));@@ -39,7 +39,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const deactivateWorkCell = await deleteWorkCell(client, workCellId);if (deactivateWorkCell.error) {- return redirect(+ throw redirect(path.to.workCells,await flash(request,@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.workCells,await flash(request, success("Successfully deleted work cell")));diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.cell.new.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.cell.new.tsxindex 380d43649d..77dd8a2a75 100644--- a/apps/carbon/app/routes/x+/resources+/work-cells.cell.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/work-cells.cell.new.tsx@@ -39,5 +39,5 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(path.to.workCells);+ throw redirect(path.to.workCells);}diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.delete.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.delete.$typeId.tsxindex a4c8331199..18686c7cee 100644--- a/apps/carbon/app/routes/x+/resources+/work-cells.delete.$typeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/work-cells.delete.$typeId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const { typeId } = params;if (!typeId) {- return redirect(+ throw redirect(path.to.workCells,await flash(request, error(params, "Failed to get a work cell type id")));@@ -21,7 +21,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const deactivateWorkCellType = await deleteWorkCellType(client, typeId);if (deactivateWorkCellType.error) {- return redirect(+ throw redirect(path.to.workCells,await flash(request,@@ -33,7 +33,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {);}- return redirect(+ throw redirect(path.to.workCells,await flash(request, success("Successfully deactivated work cell type")));diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsxindex b863280af0..37687fcb60 100644--- a/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsx+++ b/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsx@@ -23,7 +23,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const workCell = await getWorkCell(client, workCellId);if (workCell.error) {- return redirect(+ throw redirect(path.to.workCellTypeList(typeId),await flash(request, error(workCell.error, "Failed to fetch work cell")));diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.tsxindex 1be51294e1..5203ee1c62 100644--- a/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.tsx+++ b/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const workCellType = await getWorkCellType(client, typeId);if (workCellType.error) {- return redirect(+ throw redirect(path.to.workCells,await flash(request,diff --git a/apps/carbon/app/routes/x+/rfq+/delete.$id.tsx b/apps/carbon/app/routes/x+/rfq+/delete.$id.tsxindex 9ae3831d52..16a4a61fb6 100644--- a/apps/carbon/app/routes/x+/rfq+/delete.$id.tsx+++ b/apps/carbon/app/routes/x+/rfq+/delete.$id.tsx@@ -19,7 +19,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const remove = await deleteRequestForQuote(client, id);if (remove.error) {- return redirect(+ throw redirect(path.to.requestForQuotes,await flash(request,@@ -28,5 +28,5 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.requestForQuotes);+ throw redirect(path.to.requestForQuotes);}diff --git a/apps/carbon/app/routes/x+/rfq+/new.tsx b/apps/carbon/app/routes/x+/rfq+/new.tsxindex 9331d368a9..cdfc12dff2 100644--- a/apps/carbon/app/routes/x+/rfq+/new.tsx+++ b/apps/carbon/app/routes/x+/rfq+/new.tsx@@ -31,7 +31,7 @@ export async function action({ request }: ActionFunctionArgs) {const nextSequence = await getNextSequence(client, "requestForQuote", userId);if (nextSequence.error) {- return redirect(+ throw redirect(path.to.newRequestForQuote,await flash(request,@@ -50,7 +50,7 @@ export async function action({ request }: ActionFunctionArgs) {if (createRequestForQuote.error || !createRequestForQuote.data?.[0]) {// TODO: this should be done as a transactionawait rollbackNextSequence(client, "requestForQuote", userId);- return redirect(+ throw redirect(path.to.requestForQuotes,await flash(request,@@ -61,7 +61,7 @@ export async function action({ request }: ActionFunctionArgs) {const order = createRequestForQuote.data?.[0];- return redirect(path.to.requestForQuote(order.id!));+ throw redirect(path.to.requestForQuote(order.id!));}export default function RequestForQuoteNewRoute() {diff --git a/apps/carbon/app/routes/x+/sales+/_index.tsx b/apps/carbon/app/routes/x+/sales+/_index.tsxindex 304a160884..4b98473da8 100644--- a/apps/carbon/app/routes/x+/sales+/_index.tsx+++ b/apps/carbon/app/routes/x+/sales+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.customers);+ throw redirect(path.to.customers);}diff --git a/apps/carbon/app/routes/x+/sales+/customer-statuses.$customerStatusId.tsx b/apps/carbon/app/routes/x+/sales+/customer-statuses.$customerStatusId.tsxindex 9131160a4b..0c2ffea6aa 100644--- a/apps/carbon/app/routes/x+/sales+/customer-statuses.$customerStatusId.tsx+++ b/apps/carbon/app/routes/x+/sales+/customer-statuses.$customerStatusId.tsx@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customerStatus = await getCustomerStatus(client, customerStatusId);if (customerStatus.error) {- return redirect(+ throw redirect(path.to.customerStatuses,await flash(request,@@ -76,7 +76,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customerStatuses,await flash(request, success("Updated customer status")));diff --git a/apps/carbon/app/routes/x+/sales+/customer-statuses.delete.$customerStatusId.tsx b/apps/carbon/app/routes/x+/sales+/customer-statuses.delete.$customerStatusId.tsxindex f56952be49..0e94841a94 100644--- a/apps/carbon/app/routes/x+/sales+/customer-statuses.delete.$customerStatusId.tsx+++ b/apps/carbon/app/routes/x+/sales+/customer-statuses.delete.$customerStatusId.tsx@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customerStatus = await getCustomerStatus(client, customerStatusId);if (customerStatus.error) {- return redirect(+ throw redirect(`${path.to.customerStatuses}?${getParams(request)}`,await flash(request,@@ -38,7 +38,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { customerStatusId } = params;if (!customerStatusId) {- return redirect(+ throw redirect(`${path.to.customerStatuses}?${getParams(request)}`,await flash(request, error(params, "Failed to get an customer status id")));@@ -49,7 +49,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customerStatusId);if (deleteStatusError) {- return redirect(+ throw redirect(`${path.to.customerStatuses}?${getParams(request)}`,await flash(request,@@ -58,7 +58,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.customerStatuses}?${getParams(request)}`,await flash(request, success("Successfully deleted customer status")));diff --git a/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsxindex 0e1c0e7384..ca56af383b 100644--- a/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx+++ b/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customerType = await getCustomerType(client, customerTypeId);if (customerType?.data?.protected) {- return redirect(+ throw redirect(`${path.to.customerTypes}?${getParams(request)}`,await flash(request, error(null, "Cannot edit a protected customer type")));@@ -71,7 +71,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.customerTypes}?${getParams(request)}`,await flash(request, success("Updated customer type")));diff --git a/apps/carbon/app/routes/x+/sales+/customer-types.delete.$customerTypeId.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.delete.$customerTypeId.tsxindex 35a7635f58..10ae4b1ae1 100644--- a/apps/carbon/app/routes/x+/sales+/customer-types.delete.$customerTypeId.tsx+++ b/apps/carbon/app/routes/x+/sales+/customer-types.delete.$customerTypeId.tsx@@ -18,7 +18,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customerType = await getCustomerType(client, customerTypeId);if (customerType.error) {- return redirect(+ throw redirect(`${path.to.customerTypes}?${getParams(request)}`,await flash(request,@@ -37,7 +37,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { customerTypeId } = params;if (!customerTypeId) {- return redirect(+ throw redirect(`${path.to.customerTypes}?${getParams(request)}`,await flash(request, error(params, "Failed to get an customer type id")));@@ -48,7 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customerTypeId);if (deleteTypeError) {- return redirect(+ throw redirect(`${path.to.customerTypes}?${getParams(request)}`,await flash(request,@@ -57,7 +57,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(`${path.to.customerTypes}?${getParams(request)}`,await flash(request, success("Successfully deleted customer type")));diff --git a/apps/carbon/app/routes/x+/service+/$serviceId._index.tsx b/apps/carbon/app/routes/x+/service+/$serviceId._index.tsxindex 4e3e4694b7..c91d8020ec 100644--- a/apps/carbon/app/routes/x+/service+/$serviceId._index.tsx+++ b/apps/carbon/app/routes/x+/service+/$serviceId._index.tsx@@ -5,5 +5,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { serviceId } = params;if (!serviceId) throw new Error("Could not find serviceId");- return redirect(path.to.serviceDetails(serviceId));+ throw redirect(path.to.serviceDetails(serviceId));}diff --git a/apps/carbon/app/routes/x+/service+/$serviceId.details.tsx b/apps/carbon/app/routes/x+/service+/$serviceId.details.tsxindex 41166dda04..f0cf376d02 100644--- a/apps/carbon/app/routes/x+/service+/$serviceId.details.tsx+++ b/apps/carbon/app/routes/x+/service+/$serviceId.details.tsx@@ -36,13 +36,13 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (updatePart.error) {- return redirect(+ throw redirect(path.to.service(serviceId),await flash(request, error(updatePart.error, "Failed to update part")));}- return redirect(+ throw redirect(path.to.service(serviceId),await flash(request, success("Updated part")));diff --git a/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.new.tsx b/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.new.tsxindex 6081b6345d..68c6abb52c 100644--- a/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.new.tsx+++ b/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.new.tsx@@ -41,7 +41,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (createServiceSupplier.error) {- return redirect(+ throw redirect(path.to.serviceSuppliers(serviceId),await flash(request,@@ -50,7 +50,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(path.to.serviceSuppliers(serviceId));+ throw redirect(path.to.serviceSuppliers(serviceId));}export default function NewServiceSupplierRoute() {diff --git a/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.tsx b/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.tsxindex e2dac39c6c..82b1279962 100644--- a/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.tsx+++ b/apps/carbon/app/routes/x+/service+/$serviceId.suppliers.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (serviceSuppliers.error) {- return redirect(+ throw redirect(path.to.service(serviceId),await flash(request,diff --git a/apps/carbon/app/routes/x+/service+/$serviceId.tsx b/apps/carbon/app/routes/x+/service+/$serviceId.tsxindex 1bc81455f0..067fef9046 100644--- a/apps/carbon/app/routes/x+/service+/$serviceId.tsx+++ b/apps/carbon/app/routes/x+/service+/$serviceId.tsx@@ -24,7 +24,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const [service] = await Promise.all([getService(client, serviceId)]);if (service.error) {- return redirect(+ throw redirect(path.to.parts,await flash(request, error(service.error, "Failed to load service")));diff --git a/apps/carbon/app/routes/x+/service+/new.tsx b/apps/carbon/app/routes/x+/service+/new.tsxindex 4f6c40a16b..2f60d11005 100644--- a/apps/carbon/app/routes/x+/service+/new.tsx+++ b/apps/carbon/app/routes/x+/service+/new.tsx@@ -35,7 +35,7 @@ export async function action({ request }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (createService.error) {- return redirect(+ throw redirect(path.to.services,await flash(request,@@ -46,7 +46,7 @@ export async function action({ request }: ActionFunctionArgs) {const serviceId = createService.data?.id;if (!serviceId) {- return redirect(+ throw redirect(path.to.services,await flash(request,@@ -55,7 +55,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(path.to.service(serviceId));+ throw redirect(path.to.service(serviceId));}export default function ServiceNewRoute() {diff --git a/apps/carbon/app/routes/x+/settings+/_index.tsx b/apps/carbon/app/routes/x+/settings+/_index.tsxindex 881682afce..bbbcb3acb6 100644--- a/apps/carbon/app/routes/x+/settings+/_index.tsx+++ b/apps/carbon/app/routes/x+/settings+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.company);+ throw redirect(path.to.company);}diff --git a/apps/carbon/app/routes/x+/settings+/company.tsx b/apps/carbon/app/routes/x+/settings+/company.tsxindex af986db8b6..debfef5094 100644--- a/apps/carbon/app/routes/x+/settings+/company.tsx+++ b/apps/carbon/app/routes/x+/settings+/company.tsx@@ -62,13 +62,13 @@ export async function action({ request }: ActionFunctionArgs) {if (logoPath === null || typeof logoPath === "string") {const logoUpdate = await updateLogo(client, logoPath);if (logoUpdate.error) {- return redirect(+ throw redirect(path.to.company,await flash(request, error(logoUpdate.error, "Failed to update logo")));}- return redirect(+ throw redirect(path.to.company,await flash(request,@@ -80,7 +80,7 @@ export async function action({ request }: ActionFunctionArgs) {));} else {- return redirect(+ throw redirect(path.to.company,await flash(request, error(null, "Invalid logo path")));diff --git a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.$id.tsx b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.$id.tsxindex 9b9ad6a939..5aa6cc050a 100644--- a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.$id.tsx+++ b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.$id.tsx@@ -35,7 +35,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customField = await getCustomField(client, id);if (customField.error) {- return redirect(+ throw redirect(path.to.customFieldList(tableId),await flash(request,@@ -79,7 +79,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(`${path.to.customFieldList(tableId)}?${getParams(request)}`);+ throw redirect(`${path.to.customFieldList(tableId)}?${getParams(request)}`);}export default function UpdateCustomFieldRoute() {diff --git a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.delete.$id.tsx b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.delete.$id.tsxindex 6b81b10442..c75609fa41 100644--- a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.delete.$id.tsx+++ b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.delete.$id.tsx@@ -17,7 +17,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {const deleteField = await deleteCustomField(client, id);if (deleteField.error) {- return redirect(+ throw redirect(path.to.attributes,await flash(request,@@ -26,7 +26,7 @@ export async function action({ request, params }: LoaderFunctionArgs) {);}- return redirect(+ throw redirect(path.to.customFieldList(tableId),await flash(request, success("Successfully deleted custom field")));diff --git a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.new.tsx b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.new.tsxindex 1c26a4e5b5..e4f90f7b74 100644--- a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.new.tsx+++ b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.new.tsx@@ -43,7 +43,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(`${path.to.customFieldList(tableId)}?${getParams(request)}`);+ throw redirect(`${path.to.customFieldList(tableId)}?${getParams(request)}`);}export default function NewCustomFieldRoute() {diff --git a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.tsx b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.tsxindex 9aac671b7e..6b91b883c5 100644--- a/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.tsx+++ b/apps/carbon/app/routes/x+/settings+/custom-fields.$tableId.tsx@@ -22,7 +22,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const customFields = await getCustomFields(client, tableId);if (customFields.error) {- return redirect(+ throw redirect(path.to.customFields,await flash(request,diff --git a/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsx b/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsxindex f1059ae3c0..aa65549aa2 100644--- a/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsx+++ b/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsx@@ -27,7 +27,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const integration = await getIntegration(client, "exchange-rates-v1");if (integration.error) {- return redirect(+ throw redirect(path.to.integrations,await flash(request,@@ -73,7 +73,7 @@ export async function action({ request }: ActionFunctionArgs) {updatedBy: userId,});if (update.error) {- return redirect(+ throw redirect(path.to.integrations,await flash(request,@@ -82,7 +82,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.integrations,await flash(request, success("Updated exchange rates integration")));diff --git a/apps/carbon/app/routes/x+/settings+/integrations.google-places-v2.tsx b/apps/carbon/app/routes/x+/settings+/integrations.google-places-v2.tsxindex d645de7bb6..d58ab4bfc8 100644--- a/apps/carbon/app/routes/x+/settings+/integrations.google-places-v2.tsx+++ b/apps/carbon/app/routes/x+/settings+/integrations.google-places-v2.tsx@@ -27,7 +27,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const integration = await getIntegration(client, "google-places-v2");if (integration.error) {- return redirect(+ throw redirect(path.to.integrations,await flash(request,@@ -73,7 +73,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (update.error) {- return redirect(+ throw redirect(path.to.integrations,await flash(request,@@ -82,7 +82,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.integrations,await flash(request, success("Updated Google Places integration")));diff --git a/apps/carbon/app/routes/x+/settings+/integrations.resend.tsx b/apps/carbon/app/routes/x+/settings+/integrations.resend.tsxindex 789eeec958..bb114f8655 100644--- a/apps/carbon/app/routes/x+/settings+/integrations.resend.tsx+++ b/apps/carbon/app/routes/x+/settings+/integrations.resend.tsx@@ -27,7 +27,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const integration = await getIntegration(client, "resend");if (integration.error) {- return redirect(+ throw redirect(path.to.integrations,await flash(request,@@ -73,7 +73,7 @@ export async function action({ request, params }: ActionFunctionArgs) {updatedBy: userId,});if (update.error) {- return redirect(+ throw redirect(path.to.integrations,await flash(request,@@ -82,7 +82,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.integrations,await flash(request, success("Updated Resend integration")));diff --git a/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsx b/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsxindex 240a66caf6..1f9fc71eae 100644--- a/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsx+++ b/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsx@@ -25,7 +25,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const sequence = await getSequence(client, tableId);if (sequence.error) {- return redirect(+ throw redirect(path.to.sequences,await flash(request, error(sequence.error, "Failed to get sequence")));@@ -64,7 +64,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.sequences,await flash(request, success("Updated sequence")));diff --git a/apps/carbon/app/routes/x+/shared+/notes.$noteId.delete.tsx b/apps/carbon/app/routes/x+/shared+/notes.$noteId.delete.tsxindex 4f716656ee..7476d086c5 100644--- a/apps/carbon/app/routes/x+/shared+/notes.$noteId.delete.tsx+++ b/apps/carbon/app/routes/x+/shared+/notes.$noteId.delete.tsx@@ -19,5 +19,5 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(request.headers.get("Referer") ?? request.url);+ throw redirect(request.headers.get("Referer") ?? request.url);}diff --git a/apps/carbon/app/routes/x+/shared+/notes.new.tsx b/apps/carbon/app/routes/x+/shared+/notes.new.tsxindex a7ec7ecd3f..2a0aec4c69 100644--- a/apps/carbon/app/routes/x+/shared+/notes.new.tsx+++ b/apps/carbon/app/routes/x+/shared+/notes.new.tsx@@ -32,5 +32,5 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(request.headers.get("Referer") ?? request.url);+ throw redirect(request.headers.get("Referer") ?? request.url);}diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsxindex 515415eadc..a84070183d 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsx@@ -5,5 +5,5 @@ import { path } from "~/utils/path";export async function loader({ params }: LoaderFunctionArgs) {const { supplierId } = params;if (!supplierId) throw new Error("Could not find supplierId");- return redirect(path.to.supplierDetails(supplierId));+ throw redirect(path.to.supplierDetails(supplierId));}diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsxindex a81bc7e8e3..e3ecc0e873 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const contact = await getSupplierContact(client, supplierContactId);if (contact.error) {- return redirect(+ throw redirect(path.to.supplierContacts(supplierId),await flash(request,@@ -74,7 +74,7 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (update.error) {- return redirect(+ throw redirect(path.to.supplierContacts(supplierId),await flash(request,@@ -83,7 +83,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.supplierContacts(supplierId),await flash(request, success("Supplier contact updated")));diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.delete.$supplierContactId.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.delete.$supplierContactId.tsxindex 02c631f6c1..40a65472aa 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.delete.$supplierContactId.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.delete.$supplierContactId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { supplierId, supplierContactId } = params;if (!supplierId || !supplierContactId) {- return redirect(+ throw redirect(path.to.suppliers,await flash(request, error(params, "Failed to get a supplier contact id")));@@ -27,7 +27,7 @@ export async function action({ request, params }: ActionFunctionArgs) {supplierContactId);if (deleteSupplierContactError) {- return redirect(+ throw redirect(path.to.supplierContacts(supplierId),await flash(request,@@ -36,7 +36,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.supplierContacts(supplierId),await flash(request, success("Successfully deleted supplier contact")));diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.tsxindex b8844fb402..a033226d3d 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.tsx@@ -17,7 +17,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const contacts = await getSupplierContacts(client, supplierId);if (contacts.error) {- return redirect(+ throw redirect(path.to.supplier(supplierId),await flash(request,diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.details.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.details.tsxindex b3bf6d86c4..e4170a57ed 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.details.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.details.tsx@@ -32,7 +32,7 @@ export async function action({ request }: ActionFunctionArgs) {const { id, ...data } = validation.data;if (!id) {- return redirect(+ throw redirect(path.to.suppliers,await flash(request, error(null, "Failed to update supplier")));@@ -45,7 +45,7 @@ export async function action({ request }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (update.error) {- return redirect(+ throw redirect(path.to.suppliers,await flash(request, error(update.error, "Failed to update supplier")));diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsxindex 2f78504eb2..a57d12f651 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const location = await getSupplierLocation(client, supplierLocationId);if (location.error) {- return redirect(+ throw redirect(path.to.supplierLocations(supplierId),await flash(request,@@ -70,7 +70,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (update.error) {- return redirect(+ throw redirect(path.to.supplierLocations(supplierId),await flash(request,@@ -79,7 +79,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.supplierLocations(supplierId),await flash(request, success("Supplier address updated")));diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.delete.$supplierLocationId.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.delete.$supplierLocationId.tsxindex ae1eb1fc0d..e0e330e411 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.delete.$supplierLocationId.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.delete.$supplierLocationId.tsx@@ -13,7 +13,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { supplierId, supplierLocationId } = params;if (!supplierId || !supplierLocationId) {- return redirect(+ throw redirect(path.to.suppliers,await flash(request,@@ -28,7 +28,7 @@ export async function action({ request, params }: ActionFunctionArgs) {supplierLocationId);if (deleteSupplierLocationError) {- return redirect(+ throw redirect(path.to.supplierLocations(supplierId),await flash(request,@@ -37,7 +37,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.supplierLocations(supplierId),await flash(request, success("Successfully deleted supplier location")));diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.tsxindex 23405cb9f9..5ad603f4c2 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.tsx@@ -17,7 +17,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const locations = await getSupplierLocations(client, supplierId);if (locations.error) {- return redirect(+ throw redirect(path.to.supplier(supplierId),await flash(request,diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsxindex a7abc869d5..13490dfd18 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const supplierPayment = await getSupplierPayment(client, supplierId);if (supplierPayment.error || !supplierPayment.data) {- return redirect(+ throw redirect(path.to.supplier(supplierId),await flash(request,@@ -65,7 +65,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (update.error) {- return redirect(+ throw redirect(path.to.supplier(supplierId),await flash(request,@@ -74,7 +74,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.supplierPayment(supplierId),await flash(request, success("Updated supplier payment")));diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsxindex 4aa6a56e46..4da2e8f62f 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsx@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const supplierShipping = await getSupplierShipping(client, supplierId);if (supplierShipping.error || !supplierShipping.data) {- return redirect(+ throw redirect(path.to.supplier(supplierId),await flash(request,@@ -65,7 +65,7 @@ export async function action({ request, params }: ActionFunctionArgs) {customFields: setCustomFields(formData),});if (update.error) {- return redirect(+ throw redirect(path.to.supplier(supplierId),await flash(request,@@ -74,7 +74,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.supplierShipping(supplierId),await flash(request, success("Updated supplier shipping")));diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.tsxindex c69c7b6289..bb6b90cdef 100644--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.tsx+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.tsx@@ -34,7 +34,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (supplier.error) {- return redirect(+ throw redirect(path.to.suppliers,await flash(request,diff --git a/apps/carbon/app/routes/x+/users+/_index.tsx b/apps/carbon/app/routes/x+/users+/_index.tsxindex 264a86db50..8cdc33122d 100644--- a/apps/carbon/app/routes/x+/users+/_index.tsx+++ b/apps/carbon/app/routes/x+/users+/_index.tsx@@ -2,5 +2,5 @@ import { redirect } from "@remix-run/node";import { path } from "~/utils/path";export async function loader() {- return redirect(path.to.employeeAccounts);+ throw redirect(path.to.employeeAccounts);}diff --git a/apps/carbon/app/routes/x+/users+/bulk-edit-permissions.tsx b/apps/carbon/app/routes/x+/users+/bulk-edit-permissions.tsxindex 5d1719a2bf..f3c7e41c7b 100644--- a/apps/carbon/app/routes/x+/users+/bulk-edit-permissions.tsx+++ b/apps/carbon/app/routes/x+/users+/bulk-edit-permissions.tsx@@ -38,7 +38,7 @@ export async function action({ request }: ActionFunctionArgs) {(permission) => userPermissionsValidator.safeParse(permission).success)) {- return redirect(+ throw redirect(path.to.employeeAccounts,await flash(request, error(permissions, "Failed to parse permissions")));@@ -58,7 +58,7 @@ export async function action({ request }: ActionFunctionArgs) {await triggerClient.sendEvents(jobs);- return redirect(+ throw redirect(`${path.to.employeeAccounts}?${getParams(request)}`,await flash(request, success("Updating user permissions")));diff --git a/apps/carbon/app/routes/x+/users+/customers.new.tsx b/apps/carbon/app/routes/x+/users+/customers.new.tsxindex fd9c79106f..76ab0fad1f 100644--- a/apps/carbon/app/routes/x+/users+/customers.new.tsx+++ b/apps/carbon/app/routes/x+/users+/customers.new.tsx@@ -36,13 +36,13 @@ export async function action({ request }: ActionFunctionArgs) {});if (customerRedirect) {- return redirect(+ throw redirect(path.to.customerContacts(customerRedirect),await flash(request, result));}- return redirect(path.to.customerAccounts, await flash(request, result));+ throw redirect(path.to.customerAccounts, await flash(request, result));}export default function () {diff --git a/apps/carbon/app/routes/x+/users+/deactivate.tsx b/apps/carbon/app/routes/x+/users+/deactivate.tsxindex 0d9d7c5c5b..938d284244 100644--- a/apps/carbon/app/routes/x+/users+/deactivate.tsx+++ b/apps/carbon/app/routes/x+/users+/deactivate.tsx@@ -30,7 +30,7 @@ export async function action({ request }: ActionFunctionArgs) {const [userId] = users;const result = await deactivateUser(client, userId);- return redirect(safeRedirect(redirectTo), await flash(request, result));+ throw redirect(safeRedirect(redirectTo), await flash(request, result));} else {const jobs = users.map<{name: string;@@ -45,7 +45,7 @@ export async function action({ request }: ActionFunctionArgs) {try {await triggerClient.sendEvents(jobs);- return redirect(+ throw redirect(safeRedirect(redirectTo),await flash(request,@@ -53,7 +53,7 @@ export async function action({ request }: ActionFunctionArgs) {));} catch (e) {- return redirect(+ throw redirect(safeRedirect(redirectTo),await flash(request, error(e, "Failed to deactivate users")));diff --git a/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx b/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsxindex e92517fd3f..587c21c186 100644--- a/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx+++ b/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx@@ -33,7 +33,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {]);if (employeeType?.data?.protected) {- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request, error(null, "Cannot edit a protected employee type")));@@ -111,7 +111,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request, success("Updated employee type")));diff --git a/apps/carbon/app/routes/x+/users+/employee-types.delete.$employeeTypeId.tsx b/apps/carbon/app/routes/x+/users+/employee-types.delete.$employeeTypeId.tsxindex e81b297a37..7504d020df 100644--- a/apps/carbon/app/routes/x+/users+/employee-types.delete.$employeeTypeId.tsx+++ b/apps/carbon/app/routes/x+/users+/employee-types.delete.$employeeTypeId.tsx@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const employeeType = await getEmployeeType(client, employeeTypeId);if (employeeType.error) {- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request,@@ -40,7 +40,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { employeeTypeId } = params;if (!employeeTypeId) {- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request, error(params, "Failed to get an employee type id")));@@ -51,7 +51,7 @@ export async function action({ request, params }: ActionFunctionArgs) {employeeTypeId);if (deleteTypeError) {- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request,@@ -62,7 +62,7 @@ export async function action({ request, params }: ActionFunctionArgs) {// TODO - delete employeeType group- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request, success("Successfully deleted employee type")));diff --git a/apps/carbon/app/routes/x+/users+/employee-types.new.tsx b/apps/carbon/app/routes/x+/users+/employee-types.new.tsxindex 44524b9f1d..1ffa9b87f6 100644--- a/apps/carbon/app/routes/x+/users+/employee-types.new.tsx+++ b/apps/carbon/app/routes/x+/users+/employee-types.new.tsx@@ -24,7 +24,7 @@ export async function loader({ request }: LoaderFunctionArgs) {const features = await getFeatures(client);if (features.error || features.data === null) {- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request, error(features.error, "Failed to get features")));@@ -106,7 +106,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.employeeTypes,await flash(request, success("Employee type created")));diff --git a/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx b/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsxindex 5f5cf7e0fc..ce59343050 100644--- a/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx+++ b/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx@@ -97,7 +97,7 @@ export async function action({ request }: ActionFunctionArgs) {permissions,});- return redirect(path.to.employeeAccounts, await flash(request, result));+ throw redirect(path.to.employeeAccounts, await flash(request, result));}export default function UsersEmployeeRoute() {diff --git a/apps/carbon/app/routes/x+/users+/employees.new.tsx b/apps/carbon/app/routes/x+/users+/employees.new.tsxindex 414503c199..5c873df881 100644--- a/apps/carbon/app/routes/x+/users+/employees.new.tsx+++ b/apps/carbon/app/routes/x+/users+/employees.new.tsx@@ -30,7 +30,7 @@ export async function action({ request }: ActionFunctionArgs) {employeeType,});- return redirect(path.to.employeeAccounts, await flash(request, result));+ throw redirect(path.to.employeeAccounts, await flash(request, result));}export default function () {diff --git a/apps/carbon/app/routes/x+/users+/employees.tsx b/apps/carbon/app/routes/x+/users+/employees.tsxindex fb1f5687f4..f812590935 100644--- a/apps/carbon/app/routes/x+/users+/employees.tsx+++ b/apps/carbon/app/routes/x+/users+/employees.tsx@@ -38,13 +38,13 @@ export async function loader({ request }: LoaderFunctionArgs) {]);if (employees.error) {- return redirect(+ throw redirect(path.to.users,await flash(request, error(employees.error, "Error loading employees")));}if (employeeTypes.error) {- return redirect(+ throw redirect(path.to.users,await flash(request,diff --git a/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx b/apps/carbon/app/routes/x+/users+/groups.$groupId.tsxindex 6f18b85571..9ed16e2c6f 100644--- a/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx+++ b/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx@@ -38,7 +38,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const groupName = groupWithMembers.data?.[0].name;if (!groupName)- return redirect(+ throw redirect(path.to.groups,await flash(request, error(groupWithMembers, "Group not found")));@@ -93,7 +93,7 @@ export async function action({ request }: ActionFunctionArgs) {));- return redirect(+ throw redirect(path.to.groups,await flash(request, success("Group updated successfully")));diff --git a/apps/carbon/app/routes/x+/users+/groups.delete.$groupId.tsx b/apps/carbon/app/routes/x+/users+/groups.delete.$groupId.tsxindex 873ec8647a..eb9295b747 100644--- a/apps/carbon/app/routes/x+/users+/groups.delete.$groupId.tsx+++ b/apps/carbon/app/routes/x+/users+/groups.delete.$groupId.tsx@@ -20,7 +20,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {const group = await getGroup(client, groupId);if (group.error) {- return redirect(+ throw redirect(path.to.groups,await flash(request, error(group.error, "Failed to get group")));@@ -36,7 +36,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { groupId } = params;if (!groupId) {- return redirect(+ throw redirect(path.to.groups,await flash(request, error(params, "Failed to get an group id")));@@ -44,13 +44,13 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteGroupError } = await deleteGroup(client, groupId);if (deleteGroupError) {- return redirect(+ throw redirect(path.to.groups,await flash(request, error(deleteGroupError, "Failed to delete group")));}- return redirect(+ throw redirect(path.to.groups,await flash(request, success("Successfully deleted group")));diff --git a/apps/carbon/app/routes/x+/users+/groups.new.tsx b/apps/carbon/app/routes/x+/users+/groups.new.tsxindex 11749a3122..3f0ebc17e2 100644--- a/apps/carbon/app/routes/x+/users+/groups.new.tsx+++ b/apps/carbon/app/routes/x+/users+/groups.new.tsx@@ -63,7 +63,7 @@ export async function action({ request }: ActionFunctionArgs) {);}- return redirect(+ throw redirect(path.to.groups,await flash(request, success("Group created")));diff --git a/apps/carbon/app/routes/x+/users+/suppliers.new.tsx b/apps/carbon/app/routes/x+/users+/suppliers.new.tsxindex 3bf72c5c36..b729d7b00e 100644--- a/apps/carbon/app/routes/x+/users+/suppliers.new.tsx+++ b/apps/carbon/app/routes/x+/users+/suppliers.new.tsx@@ -36,13 +36,13 @@ export async function action({ request }: ActionFunctionArgs) {});if (supplierRedirect) {- return redirect(+ throw redirect(path.to.supplierContacts(supplierRedirect),await flash(request, result));}- return redirect(path.to.supplierAccounts, await flash(request, result));+ throw redirect(path.to.supplierAccounts, await flash(request, result));}export default function () {diff --git a/apps/carbon/app/routes/x+/users+/suppliers.tsx b/apps/carbon/app/routes/x+/users+/suppliers.tsxindex 9124f6decd..f5a82a6954 100644--- a/apps/carbon/app/routes/x+/users+/suppliers.tsx+++ b/apps/carbon/app/routes/x+/users+/suppliers.tsx@@ -39,13 +39,13 @@ export async function loader({ request }: LoaderFunctionArgs) {getSupplierTypes(client),]);if (suppliers.error) {- return redirect(+ throw redirect(path.to.users,await flash(request, error(suppliers.error, "Error loading suppliers")));}if (supplierTypes.error) {- return redirect(+ throw redirect(path.to.users,await flash(request,diff --git a/apps/carbon/app/services/session.server.ts b/apps/carbon/app/services/session.server.tsindex 6b658d018e..f0d328cbae 100644--- a/apps/carbon/app/services/session.server.ts+++ b/apps/carbon/app/services/session.server.ts@@ -56,7 +56,7 @@ export async function createAuthSession({authSession: AuthSession;redirectTo: string;}) {- return redirect(safeRedirect(redirectTo), {+ throw redirect(safeRedirect(redirectTo), {headers: {"Set-Cookie": await commitAuthSession(request, {authSession,@@ -92,7 +92,7 @@ export async function commitAuthSession(export async function destroyAuthSession(request: Request) {const session = await getSession(request);- return redirect(path.to.login, {+ throw redirect(path.to.login, {headers: {"Set-Cookie": await sessionStorage.destroySession(session),},diff --git a/www/pages/develop/core-concepts/fetching.mdx b/www/pages/develop/core-concepts/fetching.mdxindex 6a8c2f26ba..d04785ab0b 100644--- a/www/pages/develop/core-concepts/fetching.mdx+++ b/www/pages/develop/core-concepts/fetching.mdx@@ -46,7 +46,7 @@ export async function loader({ request }: LoaderFunctionArgs) {});if (partners.error) {- return redirect(+ throw redirect("/x/resources",await flash(request, error(partners.error, "Failed to load partners")));diff --git a/www/pages/develop/core-concepts/writing.mdx b/www/pages/develop/core-concepts/writing.mdxindex 7e39b22952..e1081aaf3c 100644--- a/www/pages/develop/core-concepts/writing.mdx+++ b/www/pages/develop/core-concepts/writing.mdx@@ -104,7 +104,7 @@ export async function action({ request }: ActionFunctionArgs) {age});- return redirect(+ throw redirect("/path/to/the/next/page",await flash(request, success("Person created.")));diff --git a/www/pages/develop/tech-stack.mdx b/www/pages/develop/tech-stack.mdxindex 43ce4ce2e1..fbcbded1c5 100644--- a/www/pages/develop/tech-stack.mdx+++ b/www/pages/develop/tech-stack.mdx@@ -76,7 +76,7 @@ export async function action({params, request}) {const name = form.get("name");const price = form.get("price");const product = await database.updateProduct({ id: params.productId, name, price });- return redirect(`/products/${product.id}`);+ throw redirect(`/products/${product.id}`);}```@@ -102,7 +102,7 @@ export async function loader({request}) {.limit(10);if (error) {- return redirect('/');+ throw redirect('/');}return json(data);