@graphcommerce/hygraph-dynamic-rows 9.0.0-canary.74 → 9.0.0-canary.76

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,13 @@
1
1
  # @graphcommerce/hygraph-dynamic-rows
2
2
 
3
+ ## 9.0.0-canary.76
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2318](https://github.com/graphcommerce-org/graphcommerce/pull/2318) [`886837f`](https://github.com/graphcommerce-org/graphcommerce/commit/886837ff44d95404512716dbb9b2272c38b9ad27) - Terminate row field on DynamicRows model ([@JoshuaS98](https://github.com/JoshuaS98))
8
+
9
+ ## 9.0.0-canary.75
10
+
3
11
  ## 9.0.0-canary.74
4
12
 
5
13
  ## 9.0.0-canary.73
@@ -5,24 +5,11 @@ fragment DynamicRow on DynamicRow {
5
5
  id
6
6
  }
7
7
  }
8
-
9
- row {
10
- __typename
11
- ... on Node {
12
- id
13
- }
14
-
15
- ...RowColumnOne
16
- ...RowQuote
17
- ...RowLinks
18
- }
19
-
20
8
  rows {
21
9
  __typename
22
10
  ... on Node {
23
11
  id
24
12
  }
25
-
26
13
  ...RowColumnOne
27
14
  ...RowQuote
28
15
  ...RowLinks
@@ -119,22 +119,19 @@ export async function hygraphDynamicRows(
119
119
  const content = [...(page?.content ?? [])]
120
120
 
121
121
  dynamicResult?.data.dynamicRows.forEach((dynamicRow) => {
122
- const { placement, target, rows, row } = dynamicRow
123
- if (!rows && !row) return
124
-
125
- const rowsToMerge = rows
126
- if (row && rows.length === 0) rowsToMerge.push(row)
122
+ const { placement, target, rows } = dynamicRow
123
+ if (!rows) return
127
124
 
128
125
  if (!target) {
129
- if (placement === 'BEFORE') content.unshift(...rowsToMerge)
130
- else content.push(...rowsToMerge)
126
+ if (placement === 'BEFORE') content.unshift(...rows)
127
+ else content.push(...rows)
131
128
  return
132
129
  }
133
130
 
134
131
  const targetIdx = content.findIndex((c) => c.id === target.id)
135
- if (placement === 'BEFORE') content.splice(targetIdx, 0, ...rowsToMerge)
136
- if (placement === 'AFTER') content.splice(targetIdx + 1, 0, ...rowsToMerge)
137
- if (placement === 'REPLACE') content.splice(targetIdx, 1, ...rowsToMerge)
132
+ if (placement === 'BEFORE') content.splice(targetIdx, 0, ...rows)
133
+ if (placement === 'AFTER') content.splice(targetIdx + 1, 0, ...rows)
134
+ if (placement === 'REPLACE') content.splice(targetIdx, 1, ...rows)
138
135
  })
139
136
 
140
137
  if (!content.length) return pageResult
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": "9.0.0-canary.74",
5
+ "version": "9.0.0-canary.76",
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": "^9.0.0-canary.74",
16
- "@graphcommerce/graphcms-ui": "^9.0.0-canary.74",
17
- "@graphcommerce/graphql": "^9.0.0-canary.74",
18
- "@graphcommerce/image": "^9.0.0-canary.74",
19
- "@graphcommerce/next-ui": "^9.0.0-canary.74",
20
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.74",
21
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.74",
15
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.76",
16
+ "@graphcommerce/graphcms-ui": "^9.0.0-canary.76",
17
+ "@graphcommerce/graphql": "^9.0.0-canary.76",
18
+ "@graphcommerce/image": "^9.0.0-canary.76",
19
+ "@graphcommerce/next-ui": "^9.0.0-canary.76",
20
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.76",
21
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.76",
22
22
  "@mui/material": "^5.10.16",
23
23
  "next": "*",
24
24
  "react": "^18.2.0",