@graphcommerce/hygraph-dynamic-rows 8.1.0-canary.41 → 8.1.0-canary.43

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,9 @@
1
1
  # @graphcommerce/hygraph-dynamic-rows
2
2
 
3
+ ## 8.1.0-canary.43
4
+
5
+ ## 8.1.0-canary.42
6
+
3
7
  ## 8.1.0-canary.41
4
8
 
5
9
  ## 8.1.0-canary.40
@@ -1,4 +1,5 @@
1
1
  import type { ApolloClient, NormalizedCacheObject, ApolloQueryResult } from '@apollo/client'
2
+ import { cacheFirst } from '@graphcommerce/graphql'
2
3
  import { AllDynamicRowsDocument, AllDynamicRowsQuery } from '../graphql'
3
4
 
4
5
  type DynamicRows = AllDynamicRowsQuery['dynamicRows']
@@ -8,10 +9,11 @@ export async function getAllHygraphDynamicRows(
8
9
  options: { pageSize?: number } = {},
9
10
  ) {
10
11
  const { pageSize = 100 } = options
12
+
11
13
  const query = client.query({
12
14
  query: AllDynamicRowsDocument,
13
15
  variables: { first: pageSize },
14
- fetchPolicy: process.env.NODE_ENV !== 'development' ? 'cache-first' : undefined,
16
+ fetchPolicy: cacheFirst(client),
15
17
  })
16
18
 
17
19
  const pages: Promise<ApolloQueryResult<AllDynamicRowsQuery>>[] = [query]
@@ -24,7 +26,7 @@ export async function getAllHygraphDynamicRows(
24
26
  client.query({
25
27
  query: AllDynamicRowsDocument,
26
28
  variables: { first: pageSize, skip: pageSize * (i - 1) },
27
- fetchPolicy: process.env.NODE_ENV !== 'development' ? 'cache-first' : undefined,
29
+ fetchPolicy: cacheFirst(client),
28
30
  }),
29
31
  )
30
32
  }
@@ -1,5 +1,5 @@
1
1
  import { HygraphPagesQuery } from '@graphcommerce/graphcms-ui'
2
- import { ApolloClient, NormalizedCacheObject } from '@graphcommerce/graphql'
2
+ import { ApolloClient, NormalizedCacheObject, cacheFirst } from '@graphcommerce/graphql'
3
3
  import {
4
4
  ConditionTextFragment,
5
5
  ConditionNumberFragment,
@@ -94,8 +94,7 @@ export async function hygraphDynamicRows(
94
94
  cached: boolean,
95
95
  additionalProperties?: Promise<object> | object,
96
96
  ): Promise<{ data: HygraphPagesQuery }> {
97
- const alwaysCache = process.env.NODE_ENV !== 'development' ? 'cache-first' : undefined
98
- const fetchPolicy = cached ? alwaysCache : undefined
97
+ const fetchPolicy = cached ? cacheFirst(client) : undefined
99
98
 
100
99
  const allRoutes = await getAllHygraphDynamicRows(client)
101
100
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/hygraph-dynamic-rows",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.1.0-canary.41",
5
+ "version": "8.1.0-canary.43",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,13 +12,13 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.41",
16
- "@graphcommerce/graphcms-ui": "^8.1.0-canary.41",
17
- "@graphcommerce/graphql": "^8.1.0-canary.41",
18
- "@graphcommerce/image": "^8.1.0-canary.41",
19
- "@graphcommerce/next-ui": "^8.1.0-canary.41",
20
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.41",
21
- "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.41",
15
+ "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.43",
16
+ "@graphcommerce/graphcms-ui": "^8.1.0-canary.43",
17
+ "@graphcommerce/graphql": "^8.1.0-canary.43",
18
+ "@graphcommerce/image": "^8.1.0-canary.43",
19
+ "@graphcommerce/next-ui": "^8.1.0-canary.43",
20
+ "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.43",
21
+ "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.43",
22
22
  "@mui/material": "^5.10.16",
23
23
  "next": "*",
24
24
  "react": "^18.2.0",