From 8ea98037e52c39642d4ea28df7192f39dbe5f8b1 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov <34226834+skirkru@users.noreply.github.com> Date: Sun, 24 Aug 2025 20:31:27 +0300 Subject: [PATCH] fix(composables): Correct inverted logic in version check causing infinite loop thus OOM (#421) Corrects the `satisfiesVersionBy` logic in the `useVersionedLocalStorage` composable. The previous implementation (`v !== '1.0.2'`) was inverted, causing it to return `false` for the valid version. This triggered the `onVersionMismatch` handler, which reset the data, re-triggered the `watch` effect, and resulted in an infinite recursive update loop, crashing the application. The condition has been changed to `v === '1.0.2' to correctly validate the version and prevent the loop. I though this is tauri fault, but kek just silly mistake Fix #414 #375 #400 --- apps/stage-tamagotchi/src/stores/shortcuts.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/stage-tamagotchi/src/stores/shortcuts.ts b/apps/stage-tamagotchi/src/stores/shortcuts.ts index 33df89550..a6cddf059 100644 --- a/apps/stage-tamagotchi/src/stores/shortcuts.ts +++ b/apps/stage-tamagotchi/src/stores/shortcuts.ts @@ -73,7 +73,7 @@ export const useShortcutsStore = defineStore('shortcuts', () => { const shortcuts = ref([ { name: 'tamagotchi.settings.pages.themes.window-shortcuts.toggle-move.label', - shortcut: useVersionedLocalStorage('shortcuts/window/move', 'Shift+Alt+N', { defaultVersion: '1.0.2', satisfiesVersionBy: v => v !== '1.0.2', onVersionMismatch: () => ({ action: 'reset' }) }), // Shift + Alt + N + shortcut: useVersionedLocalStorage('shortcuts/window/move', 'Shift+Alt+N', { defaultVersion: '1.0.2', satisfiesVersionBy: v => v === '1.0.2', onVersionMismatch: () => ({ action: 'reset' }) }), // Shift + Alt + N group: 'window', type: 'move', handle: async () => { @@ -82,7 +82,7 @@ export const useShortcutsStore = defineStore('shortcuts', () => { }, { name: 'tamagotchi.settings.pages.themes.window-shortcuts.toggle-resize.label', - shortcut: useVersionedLocalStorage('shortcuts/window/resize', 'Shift+Alt+A', { defaultVersion: '1.0.2', satisfiesVersionBy: v => v !== '1.0.2', onVersionMismatch: () => ({ action: 'reset' }) }), // Shift + Alt + A + shortcut: useVersionedLocalStorage('shortcuts/window/resize', 'Shift+Alt+A', { defaultVersion: '1.0.2', satisfiesVersionBy: v => v === '1.0.2', onVersionMismatch: () => ({ action: 'reset' }) }), // Shift + Alt + A group: 'window', type: 'resize', handle: async () => { @@ -91,7 +91,7 @@ export const useShortcutsStore = defineStore('shortcuts', () => { }, { name: 'tamagotchi.settings.pages.themes.window-shortcuts.toggle-ignore-mouse-event.label', - shortcut: useVersionedLocalStorage('shortcuts/window/debug', 'Shift+Alt+I', { defaultVersion: '1.0.2', satisfiesVersionBy: v => v !== '1.0.2', onVersionMismatch: () => ({ action: 'reset' }) }), // Shift + Alt + I + shortcut: useVersionedLocalStorage('shortcuts/window/debug', 'Shift+Alt+I', { defaultVersion: '1.0.2', satisfiesVersionBy: v => v === '1.0.2', onVersionMismatch: () => ({ action: 'reset' }) }), // Shift + Alt + I group: 'window', type: 'ignore-mouse-event', handle: async () => {