Skip to content

Commit

Permalink
Merge pull request #2041 from graphcommerce-org/fix/remove-deprecated
Browse files Browse the repository at this point in the history
Remove legacyProductRoute functionality from GraphCommerce
  • Loading branch information
paales authored Jan 4, 2024
2 parents 2cf4df2 + e7380d8 commit 1587448
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 1,117 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-bears-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphcommerce/magento-product": major
---

Removed legacyProductRoute from GraphCommerce
5 changes: 2 additions & 3 deletions docs/upgrading/graphcommerce-5-to-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ The route for the product has changed from `/product/[url]`,
`/product/configurable/[url]`, etc. to `/p/[url]` by default. This is a
singlular product page for all product types.

You can keep using the old behavior by setting
[legacyProductRoute](../framework/config.md#legacyproductroute-boolean) to true.
This legacy routing will be removed in a future version.
~~You can keep using the old behavior by setting `legacyProductRoute` to true.~~
The legacy routing has been removed in GraphCommerce 8.

You can also change the product route from `/p/[url]` to something else by
configuring [productRoute](../framework/config.md#productroute-string)
Expand Down
18 changes: 18 additions & 0 deletions docs/upgrading/graphcommerce-7-to-8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Upgrading from GraphCommerce 6 to 7

Depending on the amounts of customisations you've made, there are some manual
steps. Please follow the regular [upgrade steps first](./readme.md).

1. [`legacyProductRoute` is removed](#legacyproductroute-is-removed)
2. [Upgrading your Hygraph schema](#upgrading-your-hygraph-schema)

## `legacyProductRoute` is removed

🟠 Only required if you've used the legacyProductRoute

Remove all `/pages/product/*` routes.

## Upgrading your Hygraph schema

Upgrade your Hygraph schema with the [Hygraph migration cli](../hygraph/cli.md).
Select `graphcommerce7to8` as version.
3 changes: 3 additions & 0 deletions examples/magento-graphcms/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const nextConfig = {
maxInactiveAge: 1000 * 60 * 10,
pagesBufferLength: 10,
},
experimental: {
scrollRestoration: true,
},
optimizeFonts: false,
images: {
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
Expand Down
3 changes: 0 additions & 3 deletions examples/magento-graphcms/pages/p/[url].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ ProductPage.pageOptions = {
export default ProductPage

export const getStaticPaths: GetPageStaticPaths = async ({ locales = [] }) => {
if (import.meta.graphCommerce.legacyProductRoute) return { paths: [], fallback: false }
if (process.env.NODE_ENV === 'development') return { paths: [], fallback: 'blocking' }

const path = (locale: string) => getProductStaticPaths(graphqlSsrClient(locale), locale)
Expand All @@ -215,8 +214,6 @@ export const getStaticPaths: GetPageStaticPaths = async ({ locales = [] }) => {
}

export const getStaticProps: GetPageStaticProps = async ({ params, locale }) => {
if (import.meta.graphCommerce.legacyProductRoute) return { notFound: true }

const client = graphqlSharedClient(locale)
const staticClient = graphqlSsrClient(locale)

Expand Down
159 changes: 0 additions & 159 deletions examples/magento-graphcms/pages/product/[url].tsx

This file was deleted.

167 changes: 0 additions & 167 deletions examples/magento-graphcms/pages/product/bundle/[url].tsx

This file was deleted.

Loading

0 comments on commit 1587448

Please sign in to comment.