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
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user