@unhead/vue 0.6.4 → 0.6.5

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/dist/index.cjs CHANGED
@@ -526,14 +526,17 @@ function resolveUnrefHeadInput(ref, lastKey = "") {
526
526
  if (Array.isArray(root))
527
527
  return root.map((r) => resolveUnrefHeadInput(r, lastKey));
528
528
  if (typeof root === "object") {
529
+ let dynamic = false;
529
530
  const unrefdObj = Object.fromEntries(
530
- Object.entries(root).map(([key, value]) => {
531
- if (key === "titleTemplate" || key.startsWith("on"))
532
- return [key, vue.unref(value)];
533
- return [key, resolveUnrefHeadInput(value, key)];
531
+ Object.entries(root).map(([k, v]) => {
532
+ if (k === "titleTemplate" || k.startsWith("on"))
533
+ return [k, vue.unref(v)];
534
+ if (typeof v === "function" || vue.isRef(v))
535
+ dynamic = true;
536
+ return [k, resolveUnrefHeadInput(v, k)];
534
537
  })
535
538
  );
536
- if (HasElementTags.includes(String(lastKey)) && JSON.stringify(unrefdObj) !== JSON.stringify(root))
539
+ if (dynamic && HasElementTags.includes(String(lastKey)))
537
540
  unrefdObj._dynamic = true;
538
541
  return unrefdObj;
539
542
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { unref, version, getCurrentInstance, inject, nextTick, ref, watchEffect, watch, onBeforeUnmount } from 'vue';
1
+ import { unref, isRef, version, getCurrentInstance, inject, nextTick, ref, watchEffect, watch, onBeforeUnmount } from 'vue';
2
2
  import { createHooks } from 'hookable';
3
3
 
4
4
  const ValidHeadTags = [
@@ -524,14 +524,17 @@ function resolveUnrefHeadInput(ref, lastKey = "") {
524
524
  if (Array.isArray(root))
525
525
  return root.map((r) => resolveUnrefHeadInput(r, lastKey));
526
526
  if (typeof root === "object") {
527
+ let dynamic = false;
527
528
  const unrefdObj = Object.fromEntries(
528
- Object.entries(root).map(([key, value]) => {
529
- if (key === "titleTemplate" || key.startsWith("on"))
530
- return [key, unref(value)];
531
- return [key, resolveUnrefHeadInput(value, key)];
529
+ Object.entries(root).map(([k, v]) => {
530
+ if (k === "titleTemplate" || k.startsWith("on"))
531
+ return [k, unref(v)];
532
+ if (typeof v === "function" || isRef(v))
533
+ dynamic = true;
534
+ return [k, resolveUnrefHeadInput(v, k)];
532
535
  })
533
536
  );
534
- if (HasElementTags.includes(String(lastKey)) && JSON.stringify(unrefdObj) !== JSON.stringify(root))
537
+ if (dynamic && HasElementTags.includes(String(lastKey)))
535
538
  unrefdObj._dynamic = true;
536
539
  return unrefdObj;
537
540
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "0.6.4",
4
+ "version": "0.6.5",
5
5
  "packageManager": "pnpm@7.14.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -33,11 +33,11 @@
33
33
  "vue": ">=2.7 || >=3"
34
34
  },
35
35
  "dependencies": {
36
- "@unhead/schema": "0.6.4",
36
+ "@unhead/schema": "0.6.5",
37
37
  "hookable": "^5.4.1"
38
38
  },
39
39
  "devDependencies": {
40
- "unhead": "0.6.4",
40
+ "unhead": "0.6.5",
41
41
  "vue": "^3.2.45"
42
42
  },
43
43
  "scripts": {