3.15 -> 3.16
This page lists the highlights for upgrading a project from Front-Commerce 3.15 to 3.16
Update dependencies
Update all your @front-commerce/*
dependencies to this version:
pnpm update "@front-commerce/*@3.16.0"
Automated Migration
We provide a codemod to automatically update your codebase to the latest version of Front-Commerce.
pnpm run front-commerce migrate --transform 3.16.0
Those changes will be applied automatically by the codemod :
Breaking Changes
FormData Usage
With Front-Commerce 3.16, we have modified the way we handle Form submission for add to cart and update cart item from cart page. This way introduces a more HTML compliant way to submit form data.
You will need to update your code only if you have overriden any of the following files:
routes/api.cart.items.ts
routes/api.cart.items.$id.ts
theme/modules/AddToCart/AddToCart.jsx
theme/modules/Cart/CartItem/CartItemOptionsUpdater/useUpdateCartItemOptions.ts
If you haven't overriden any of these files, you can skip this section.
Sending FormData
To update how the AddToCart
component and the useUpdateCartItemOptions
hook
send data to the API, we have introduced a codemod that will update your code to
the new format.
This update will be applied automatically by the codemod (see Automated Migration).
API Routes
API routes have been updated to accept the data in the new format or in the old format. The old format support has been implemented to reduce the impact of the migration. However, we recommend you to update your code to use the new format as the legacy format will be removed in Front-Commerce 4.0.
To update the route to the new format, we recommend you to apply the following changes to your routes:
Possible compatibility issues
GraphQL File scalar
In Front-Commerce 3.16, we have introduced a new GraphQL scalar for file upload. This scalar is used to handle file upload in the GraphQL schema. it represent a File object.
If you've already defined the File
scalar in your GraphQL schema, you may need
to update your code either to override the default scalar or rename it to a
different name.
You can read more about this change in the GraphQL File scalar documentation.