From 003880027ba36f3d0c85b6499e8e9b39d799aa3a Mon Sep 17 00:00:00 2001 From: coffeegrind123 Date: Fri, 3 Oct 2025 17:38:27 +0300 Subject: [PATCH] fix: Resolve Vue i18n deepCopy crash causing web interface failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes web interface crashes when clients connect/disconnect by resolving Vue i18n deepCopy function errors during locale merging operations. Changes: - Disable experimental locale detector to prevent SSR locale switching - Add silentTranslationWarn/silentFallbackWarn to prevent crash-causing warnings - Enable mergeFallbackMessage for safer locale merging without deep copying - Disable lazy loading to prevent runtime locale merging issues - Add fallbackLocale and redirectOn configs for safer browser detection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/i18n/i18n.config.ts | 5 +++++ src/nuxt.config.ts | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/i18n/i18n.config.ts b/src/i18n/i18n.config.ts index d36942ba..5b98c900 100644 --- a/src/i18n/i18n.config.ts +++ b/src/i18n/i18n.config.ts @@ -17,6 +17,11 @@ import id from './locales/id.json'; export default defineI18nConfig(() => ({ legacy: false, fallbackLocale: 'en', + // Disable strict mode to prevent deepCopy errors with locale merging + silentTranslationWarn: true, + silentFallbackWarn: true, + // Use shallow merging to avoid deepCopy issues + mergeFallbackMessage: true, messages: { en, pl, diff --git a/src/nuxt.config.ts b/src/nuxt.config.ts index 87adfe60..e061459b 100644 --- a/src/nuxt.config.ts +++ b/src/nuxt.config.ts @@ -23,9 +23,10 @@ export default defineNuxtConfig({ }, i18n: { // https://i18n.nuxtjs.org/docs/guide/server-side-translations - experimental: { - localeDetector: './localeDetector.ts', - }, + // Disabled experimental locale detector to prevent deepCopy errors + // experimental: { + // localeDetector: './localeDetector.ts', + // }, // https://wg-easy.github.io/wg-easy/latest/contributing/translation/ locales: [ { @@ -109,7 +110,12 @@ export default defineNuxtConfig({ strategy: 'no_prefix', detectBrowserLanguage: { useCookie: true, + fallbackLocale: 'en', + // Disable redirect to prevent locale switching during SSR + redirectOn: 'root', }, + // Disable lazy loading to prevent runtime locale merging issues + lazy: false, }, nitro: { esbuild: {