@pinegrow/vite-plugin 3.0.0-beta.97 → 3.0.0-beta.98

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/index.js +17 -4
  2. package/package.json +1 -1
package/dist/vue/index.js CHANGED
@@ -53,16 +53,29 @@ export function usePinegrow() {
53
53
  if (
54
54
  elCacheObj.instance.isMounted &&
55
55
  !elCacheObj.instance.isUnmounted &&
56
- elCacheObj.localFile &&
57
- !elCacheObj.isIsland
56
+ elCacheObj.localFile
57
+ // && !elCacheObj.isIsland
58
58
  // && (!elCacheObj.rootEl || elCacheObj.isRootFragment)
59
59
  ) {
60
60
  if (!localComponents[elCacheObj.localFile]) {
61
61
  localComponents[elCacheObj.localFile] = []
62
62
  }
63
- localComponents[elCacheObj.localFile].push(
64
- enrichWithComponentName(elCacheObj, elCacheObj.localFile)
63
+ // There might be a elCache that was hydrated, and has the ile-root as a parent. If it was already there, then update the iles-root instead of adding a new node
64
+ const possibleIslandRootIndex = localComponents[elCacheObj.localFile].findIndex(
65
+ prevElCacheObj =>
66
+ prevElCacheObj.isIsland &&
67
+ prevElCacheObj.firstEl?.firstElementChild === elCacheObj.el
65
68
  )
69
+
70
+ if (possibleIslandRootIndex > -1) {
71
+ const pgId = localComponents[elCacheObj.localFile][possibleIslandRootIndex].pgId
72
+ localComponents[elCacheObj.localFile][possibleIslandRootIndex] =
73
+ enrichWithComponentName({ ...elCacheObj, pgId }, elCacheObj.localFile)
74
+ } else {
75
+ localComponents[elCacheObj.localFile].push(
76
+ enrichWithComponentName(elCacheObj, elCacheObj.localFile)
77
+ )
78
+ }
66
79
  }
67
80
  })
68
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/vite-plugin",
3
- "version": "3.0.0-beta.97",
3
+ "version": "3.0.0-beta.98",
4
4
  "description": "Pinegrow Vite Plugin",
5
5
  "type": "module",
6
6
  "files": [