it boots again

This commit is contained in:
Henry Jameson 2026-01-26 23:24:48 +02:00
commit ebe487c5d8
8 changed files with 26 additions and 20 deletions

View file

@ -19,10 +19,7 @@ import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/updat
import { useInstanceStore } from 'src/stores/instance'
import {
defaultState as configDefaultState,
instanceDefaultConfig,
} from 'src/modules/default_config_state'
import { defaultState as configDefaultState } from 'src/modules/default_config_state'
export const VERSION = 2
export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically
@ -216,7 +213,7 @@ const _mergeJournal = (...journals) => {
// side effect
journal.sort((a, b) => (a.timestamp > b.timestamp ? 1 : -1))
if (path.startsWith('collections')) {
if (path.startsWith('collections') || path.startsWith('objectCollection')) {
const lastRemoveIndex = findLastIndex(
journal,
({ operation }) => operation === 'removeFromCollection',
@ -501,7 +498,6 @@ export const useSyncConfigStore = defineStore('sync_config', {
collection.add(_key)
set(this.prefsStorage, path + '.index', [...collection])
set(this.prefsStorage, path + '.data.' + _key, value)
console.log(get(path, this.prefsStorage, path))
}
this.prefsStorage._journal = [
...this.prefsStorage._journal,
@ -660,10 +656,16 @@ export const useSyncConfigStore = defineStore('sync_config', {
},
},
getters: {
mergedConfig: (state) => ({
...useInstanceStore().prefsStorage,
...state.prefsStorage.simple,
}),
mergedConfig: (state) => {
const instancePrefs = useInstanceStore().prefsStorage
const result = Object.fromEntries(
Object.entries(state.prefsStorage.simple).map(([k, v]) => [
k,
v ?? instancePrefs[k],
]),
)
return result
},
},
persist: {
afterLoad(state) {