Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angry-kids-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

Implement unstable_rethrow fix for auth redirect errors in try/catch blo…
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BigCommerceAPIError, BigCommerceGQLError } from '@bigcommerce/catalyst-client';
import { parseWithZod } from '@conform-to/zod';
import { unstable_expireTag as expireTag } from 'next/cache';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';
import { z } from 'zod';

Expand Down Expand Up @@ -245,6 +246,8 @@ export async function createAddress(prevState: Awaited<State>, formData: FormDat
fields: prevState.fields,
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { BigCommerceGQLError } from '@bigcommerce/catalyst-client';
import { parseWithZod } from '@conform-to/zod';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';

import { ChangePasswordAction } from '@/vibes/soul/sections/account-settings/change-password-form';
Expand Down Expand Up @@ -71,6 +72,8 @@ export const changePassword: ChangePasswordAction = async (prevState, formData)
successMessage: t('passwordUpdated'),
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { BigCommerceGQLError } from '@bigcommerce/catalyst-client';
import { parseWithZod } from '@conform-to/zod';
import { unstable_expireTag } from 'next/cache';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';

import { updateAccountSchema } from '@/vibes/soul/sections/account-settings/schema';
Expand Down Expand Up @@ -83,6 +84,8 @@ export const updateCustomer: UpdateAccountAction = async (prevState, formData) =
lastResult: submission.reply(),
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { BigCommerceAPIError, BigCommerceGQLError } from '@bigcommerce/catalyst-client';
import { SubmissionResult } from '@conform-to/react';
import { parseWithZod } from '@conform-to/zod';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';
import { z } from 'zod';

Expand Down Expand Up @@ -55,6 +56,8 @@ export async function addWishlistItemToCart(prevState: State, formData: FormData
}),
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigCommerceAuthError } from '@bigcommerce/catalyst-client';
import { SubmissionResult } from '@conform-to/react';
import { parseWithZod } from '@conform-to/zod';
import { revalidateTag } from 'next/cache';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';

import { getSessionCustomerAccessToken } from '~/auth';
Expand Down Expand Up @@ -65,6 +66,8 @@ export async function newWishlist(prevState: Awaited<State>, formData: FormData)
successMessage: t('Result.createSuccess'),
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigCommerceAuthError } from '@bigcommerce/catalyst-client';
import { SubmissionResult } from '@conform-to/react';
import { parseWithZod } from '@conform-to/zod';
import { revalidateTag } from 'next/cache';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';

import { getSessionCustomerAccessToken } from '~/auth';
Expand Down Expand Up @@ -73,6 +74,8 @@ export async function removeWishlistItem(
lastResult: submission.reply(),
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigCommerceGQLError } from '@bigcommerce/catalyst-client';
import { SubmissionResult } from '@conform-to/react';
import { parseWithZod } from '@conform-to/zod';
import { FragmentOf } from 'gql.tada';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';

import { CartLineItem } from '@/vibes/soul/sections/cart';
Expand Down Expand Up @@ -332,6 +333,8 @@ export const updateLineItem = async (
quantity: cartLineItem.quantity - 1,
});
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down Expand Up @@ -365,6 +368,8 @@ export const updateLineItem = async (
try {
await removeItem({ lineItemEntityId: submission.value.id });
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { BigCommerceGQLError } from '@bigcommerce/catalyst-client';
import { SubmissionResult } from '@conform-to/react';
import { parseWithZod } from '@conform-to/zod';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';
import { ReactNode } from 'react';

Expand Down Expand Up @@ -57,6 +58,8 @@ export const addToCart = async (
}),
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { BigCommerceGQLError } from '@bigcommerce/catalyst-client';
import { SubmissionResult } from '@conform-to/react';
import { parseWithZod } from '@conform-to/zod';
import { unstable_rethrow } from 'next/navigation';
import { getTranslations } from 'next-intl/server';
import { ReactNode } from 'react';

Expand Down Expand Up @@ -175,6 +176,8 @@ export const addToCart = async (
}),
};
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { SubmissionResult } from '@conform-to/react';
import { parseWithZod } from '@conform-to/zod';
import { revalidateTag } from 'next/cache';
import { unstable_rethrow } from 'next/navigation';
import { getLocale, getTranslations } from 'next-intl/server';
import { z } from 'zod';

Expand Down Expand Up @@ -237,6 +238,8 @@ export async function wishlistAction(payload: FormData): Promise<void> {

revalidateTag(TAGS.customer);
} catch (error) {
unstable_rethrow(error);

// eslint-disable-next-line no-console
console.error(error);

Expand Down
Loading