@uipkge/nuxt 0.1.18 → 0.1.20

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/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.1.18",
7
+ "version": "0.1.20",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "unknown"
@@ -1,8 +1,8 @@
1
- import { useAsyncData, useRuntimeConfig } from "#app";
1
+ import { useLazyAsyncData, useRuntimeConfig } from "#app";
2
2
  import { computed } from "vue";
3
3
  export function useI18nowLocales() {
4
4
  const { projectId, cdnUrl } = useRuntimeConfig().public.i18now;
5
- const { data, pending, error, refresh } = useAsyncData(
5
+ const { data, pending, error, refresh } = useLazyAsyncData(
6
6
  "i18now-locales",
7
7
  async () => {
8
8
  if (!projectId) return [];
@@ -13,7 +13,7 @@ export function useI18nowLocales() {
13
13
  if (!Array.isArray(data2)) return [];
14
14
  return data2;
15
15
  },
16
- { default: () => [] }
16
+ { default: () => [], server: false }
17
17
  );
18
18
  const locales = computed(() => data.value ?? []);
19
19
  const sourceLocale = computed(() => data.value?.find((l) => l.isSource) ?? null);
@@ -15,10 +15,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
15
15
  } catch {
16
16
  }
17
17
  }
18
- const ssrKeys = nuxtApp.payload.i18nowCdnKeys;
19
- if (!ssrKeys || ssrKeys.length === 0) {
20
- await loadLocale(currentLocale);
21
- }
18
+ await loadLocale(currentLocale);
22
19
  let activeLocale = currentLocale;
23
20
  nuxtApp.hook("i18n:beforeLocaleSwitch", async ({ newLocale }) => {
24
21
  if (newLocale === activeLocale) return;
@@ -108,12 +108,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
108
108
  }
109
109
  }
110
110
  let currentLocale = locale;
111
- const ssrKeys = nuxtApp.payload.i18nowCdnKeys;
112
- if (ssrKeys && ssrKeys.length > 0) {
113
- syncer.setExistingKeys(ssrKeys);
114
- } else {
115
- await loadLocale(locale);
116
- }
111
+ await loadLocale(locale);
117
112
  const originalGlobalT = nuxtApp.vueApp.config.globalProperties.$t;
118
113
  if (originalGlobalT) {
119
114
  nuxtApp.vueApp.config.globalProperties.$t = function(key, defaultValue, ...rest) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipkge/nuxt",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {