fix config/highlight not working upon login

This commit is contained in:
Henry Jameson 2026-03-16 09:50:37 +02:00
commit 7528a72b2e
2 changed files with 9 additions and 7 deletions

View file

@ -25,7 +25,7 @@ import { defaultState as configDefaultState } from 'src/modules/default_config_s
import { defaultConfigSync } from 'src/modules/old_default_config_state.js' import { defaultConfigSync } from 'src/modules/old_default_config_state.js'
export const VERSION = 2 export const VERSION = 2
export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically export const NEW_USER_DATE = new Date('2026-03-16') // date of writing this, basically
export const COMMAND_TRIM_FLAGS = 1000 export const COMMAND_TRIM_FLAGS = 1000
export const COMMAND_TRIM_FLAGS_AND_RESET = 1001 export const COMMAND_TRIM_FLAGS_AND_RESET = 1001
@ -615,14 +615,14 @@ export const useSyncConfigStore = defineStore('sync_config', {
let dirty = false let dirty = false
console.debug('Migrating from old config') console.debug('Migrating from old config')
const vuexState = await storage.getItem('vuex-lz') const vuexState = await storage.getItem('vuex-lz') ?? {}
const { config } = vuexState vuexState.config = vuexState.config ?? {}
const migratedEntries = new Set(config._syncMigration ?? []) const migratedEntries = new Set(vuexState.config._syncMigration ?? [])
console.debug(`Already migrated Values: ${[...migratedEntries].join()}`) console.debug(`Already migrated Values: ${[...migratedEntries].join()}`)
Object.entries(defaultConfigSync).forEach(([key, value]) => { Object.entries(defaultConfigSync).forEach(([key, value]) => {
const oldValue = config[key] const oldValue = vuexState.config[key]
const defaultValue = value const defaultValue = value
const present = oldValue !== undefined const present = oldValue !== undefined

View file

@ -278,8 +278,10 @@ export const useUserHighlightStore = defineStore('user_highlight', {
const userNew = userData.created_at > NEW_USER_DATE const userNew = userData.created_at > NEW_USER_DATE
let dirty = false let dirty = false
const vuexState = await storage.getItem('vuex-lz') const vuexState = await storage.getItem('vuex-lz') ?? {}
const { highlight } = vuexState.config vuexState.config = vuexState.config ?? {}
const highlight = vuexState.config.highlight ?? {}
Object.entries(highlight).forEach(([user, value]) => { Object.entries(highlight).forEach(([user, value]) => {
if ((highlight[user]._migrated || 0) < 1) { if ((highlight[user]._migrated || 0) < 1) {
dirty = true dirty = true