@graphcommerce/magento-store 6.0.2-canary.2 → 6.0.2-canary.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.2-canary.21
4
+
5
+ ## 6.0.2-canary.20
6
+
7
+ ## 6.0.2-canary.19
8
+
9
+ ## 6.0.2-canary.18
10
+
11
+ ## 6.0.2-canary.17
12
+
13
+ ## 6.0.2-canary.16
14
+
15
+ ## 6.0.2-canary.15
16
+
17
+ ## 6.0.2-canary.14
18
+
19
+ ## 6.0.2-canary.13
20
+
21
+ ## 6.0.2-canary.12
22
+
23
+ ## 6.0.2-canary.11
24
+
25
+ ## 6.0.2-canary.10
26
+
27
+ ## 6.0.2-canary.9
28
+
29
+ ### Patch Changes
30
+
31
+ - [#1875](https://github.com/graphcommerce-org/graphcommerce/pull/1875) [`4325f6556`](https://github.com/graphcommerce-org/graphcommerce/commit/4325f6556308fe96e262e03935f37dc252f72c2e) - When trying to redirect it would do another call to fetch the config while that was already done previously ([@paales](https://github.com/paales))
32
+
33
+ ## 6.0.2-canary.8
34
+
35
+ ## 6.0.2-canary.7
36
+
37
+ ## 6.0.2-canary.6
38
+
39
+ ## 6.0.2-canary.5
40
+
41
+ ## 6.0.2-canary.4
42
+
43
+ ## 6.0.2-canary.3
44
+
3
45
  ## 6.0.2-canary.2
4
46
 
5
47
  ## 6.0.2-canary.1
@@ -26,4 +26,7 @@ fragment StoreConfigFragment on StoreConfig @injectable {
26
26
 
27
27
  product_reviews_enabled
28
28
  allow_guests_to_write_product_reviews
29
+
30
+ grid_per_page
31
+ list_per_page
29
32
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-store",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.0.2-canary.2",
5
+ "version": "6.0.2-canary.21",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,15 +12,15 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "6.0.2-canary.2",
16
- "@graphcommerce/prettier-config-pwa": "6.0.2-canary.2",
17
- "@graphcommerce/typescript-config-pwa": "6.0.2-canary.2"
15
+ "@graphcommerce/eslint-config-pwa": "6.0.2-canary.21",
16
+ "@graphcommerce/prettier-config-pwa": "6.0.2-canary.21",
17
+ "@graphcommerce/typescript-config-pwa": "6.0.2-canary.21"
18
18
  },
19
19
  "dependencies": {
20
- "@graphcommerce/graphql": "6.0.2-canary.2",
21
- "@graphcommerce/graphql-mesh": "6.0.2-canary.2",
22
- "@graphcommerce/image": "6.0.2-canary.2",
23
- "@graphcommerce/next-ui": "6.0.2-canary.2"
20
+ "@graphcommerce/graphql": "6.0.2-canary.21",
21
+ "@graphcommerce/graphql-mesh": "6.0.2-canary.21",
22
+ "@graphcommerce/image": "6.0.2-canary.21",
23
+ "@graphcommerce/next-ui": "6.0.2-canary.21"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@lingui/react": "^3.13.2",
@@ -1,8 +1,13 @@
1
1
  import { ParsedUrlQuery } from 'querystring'
2
- import { ApolloClient, flushMeasurePerf, NormalizedCacheObject } from '@graphcommerce/graphql'
2
+ import {
3
+ ApolloClient,
4
+ ApolloQueryResult,
5
+ flushMeasurePerf,
6
+ NormalizedCacheObject,
7
+ } from '@graphcommerce/graphql'
3
8
  import { nonNullable, isTypename } from '@graphcommerce/next-ui'
4
9
  import { Redirect } from 'next'
5
- import { StoreConfigDocument } from '../StoreConfig.gql'
10
+ import { StoreConfigQuery } from '../StoreConfig.gql'
6
11
  import { defaultLocale } from '../localeToStore'
7
12
  import { HandleRedirectDocument } from './HandleRedirect.gql'
8
13
 
@@ -39,6 +44,7 @@ const redirect = (from: string, to: string, permanent: boolean, locale?: string)
39
44
 
40
45
  export async function redirectOrNotFound(
41
46
  client: ApolloClient<NormalizedCacheObject>,
47
+ config: Promise<ApolloQueryResult<StoreConfigQuery>> | ApolloQueryResult<StoreConfigQuery>,
42
48
  params?: ParsedUrlQuery,
43
49
  locale?: string,
44
50
  ): RedirectOr404Return {
@@ -49,14 +55,13 @@ export async function redirectOrNotFound(
49
55
 
50
56
  try {
51
57
  // Get the configured suffixes from the store config
52
- const { product_url_suffix: prodSuffix, category_url_suffix: catSuffix } =
53
- (await client.query({ query: StoreConfigDocument })).data.storeConfig ?? {}
58
+ const { product_url_suffix, category_url_suffix } = (await config).data.storeConfig ?? {}
54
59
 
55
60
  const candidates = new Set([from])
56
61
 
57
62
  // If the incomming URL contains a suffix, we check if the URL without the suffix exists
58
63
  // if the incomming URL does not contain a suffix, we check if the URL with the suffix exists
59
- const suffixes = [prodSuffix, catSuffix].filter(nonNullable)
64
+ const suffixes = [product_url_suffix, category_url_suffix].filter(nonNullable)
60
65
  suffixes.forEach((suffix) => {
61
66
  candidates.add(from.endsWith(suffix) ? from.slice(0, -suffix.length) : `${from}${suffix}`)
62
67
  })