@unhead/vue 1.0.4 → 1.0.6

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
@@ -790,7 +790,7 @@ const VueHeadMixin = {
790
790
  const options = instance.type;
791
791
  if (!options || !("head" in options))
792
792
  return;
793
- const source = typeof options.head === "function" ? () => options.head() : options.head;
793
+ const source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
794
794
  useHead(source);
795
795
  }
796
796
  };
@@ -968,18 +968,18 @@ function changeKeyCasingDeep(input) {
968
968
 
969
969
  function clientUseHead(input, options = {}) {
970
970
  const head = injectHead();
971
- const vm = vue.getCurrentInstance();
972
- if (!vm)
973
- return head.push(input, options);
974
971
  const resolvedInput = vue.ref({});
975
972
  vue.watchEffect(() => {
976
973
  resolvedInput.value = resolveUnrefHeadInput(input);
977
974
  });
978
975
  const entry = head.push(resolvedInput.value, options);
979
976
  vue.watch(resolvedInput, (e) => entry.patch(e));
980
- vue.onBeforeUnmount(() => {
981
- entry.dispose();
982
- });
977
+ const vm = vue.getCurrentInstance();
978
+ if (vm) {
979
+ vue.onBeforeUnmount(() => {
980
+ entry.dispose();
981
+ });
982
+ }
983
983
  return entry;
984
984
  }
985
985
 
package/dist/index.mjs CHANGED
@@ -788,7 +788,7 @@ const VueHeadMixin = {
788
788
  const options = instance.type;
789
789
  if (!options || !("head" in options))
790
790
  return;
791
- const source = typeof options.head === "function" ? () => options.head() : options.head;
791
+ const source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
792
792
  useHead(source);
793
793
  }
794
794
  };
@@ -966,18 +966,18 @@ function changeKeyCasingDeep(input) {
966
966
 
967
967
  function clientUseHead(input, options = {}) {
968
968
  const head = injectHead();
969
- const vm = getCurrentInstance();
970
- if (!vm)
971
- return head.push(input, options);
972
969
  const resolvedInput = ref({});
973
970
  watchEffect(() => {
974
971
  resolvedInput.value = resolveUnrefHeadInput(input);
975
972
  });
976
973
  const entry = head.push(resolvedInput.value, options);
977
974
  watch(resolvedInput, (e) => entry.patch(e));
978
- onBeforeUnmount(() => {
979
- entry.dispose();
980
- });
975
+ const vm = getCurrentInstance();
976
+ if (vm) {
977
+ onBeforeUnmount(() => {
978
+ entry.dispose();
979
+ });
980
+ }
981
981
  return entry;
982
982
  }
983
983
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.0.4",
5
- "packageManager": "pnpm@7.17.0",
4
+ "version": "1.0.6",
5
+ "packageManager": "pnpm@7.17.1",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -34,11 +34,11 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "hookable": "^5.4.2",
37
- "@unhead/schema": "1.0.4"
37
+ "@unhead/schema": "1.0.6"
38
38
  },
39
39
  "devDependencies": {
40
40
  "vue": "^3.2.45",
41
- "unhead": "1.0.4"
41
+ "unhead": "1.0.6"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild .",