@pinegrow/vite-plugin 3.0.0-beta.46 → 3.0.0-beta.48

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.
Files changed (2) hide show
  1. package/dist/vue-plugin.js +24 -14
  2. package/package.json +1 -1
@@ -43,17 +43,20 @@ export function usePinegrow() {
43
43
  if (
44
44
  value.instance.isMounted &&
45
45
  !value.instance.isUnmounted &&
46
- value.pgId &&
46
+ value.pgIds &&
47
+ value.pgIds.length &&
47
48
  (!value.rootEl || value.isRootFragment)
48
49
  ) {
49
- if (!pgIds[value.pgId]) {
50
- pgIds[value.pgId] = []
51
- }
52
- if (value.key === undefined || value.key === null) {
53
- pgIds[value.pgId].push(value)
54
- } else {
55
- pgIds[value.pgId].push([value.key, value])
56
- }
50
+ value.pgIds.forEach(pgId => {
51
+ if (!pgIds[pgId]) {
52
+ pgIds[pgId] = []
53
+ }
54
+ if (value.key === undefined || value.key === null) {
55
+ pgIds[pgId].push(value)
56
+ } else {
57
+ pgIds[pgId].push([value.key, value])
58
+ }
59
+ })
57
60
  }
58
61
  }
59
62
  return pgIds
@@ -149,10 +152,10 @@ export function usePinegrow() {
149
152
  // return
150
153
  // }
151
154
 
152
- if (pinegrow.elCache.has(el)) {
153
- // pgId could have been updated
154
- if (pgId) {
155
- pinegrow.elCache.get(el).pgId = pgId
155
+ const prevElCache = pinegrow.elCache.get(el)
156
+ if (prevElCache) {
157
+ if (pgId && !prevElCache.pgIds.includes(pgId)) {
158
+ prevElCache.pgIds.push(pgId)
156
159
  }
157
160
  if (key !== null && key !== undefined) {
158
161
  pinegrow.elCache.get(el).key = key
@@ -224,6 +227,13 @@ export function usePinegrow() {
224
227
  lastEl = childVNodes[childVNodes.length - 1].el
225
228
  }
226
229
 
230
+ if (firstEl && firstEl.nodeType !== 1) {
231
+ firstEl = firstEl.nextElementSibling
232
+ }
233
+ if (lastEl && lastEl.nodeType !== 1) {
234
+ lastEl = lastEl.nextElementSibling
235
+ }
236
+
227
237
  childVNodes.forEach(childVNode => {
228
238
  pgUpdateElCache(hook, pgId, isRootFragment ? el : rootEl, key)(childVNode)
229
239
  })
@@ -239,7 +249,7 @@ export function usePinegrow() {
239
249
  isFragment,
240
250
  firstEl,
241
251
  lastEl,
242
- pgId,
252
+ pgIds: pgId ? [pgId] : [],
243
253
  key,
244
254
  localFile,
245
255
  isIsland,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/vite-plugin",
3
- "version": "3.0.0-beta.46",
3
+ "version": "3.0.0-beta.48",
4
4
  "description": "Pinegrow Vite Plugin",
5
5
  "type": "module",
6
6
  "files": [