fix vuex->pinia migration for sync/local stores
This commit is contained in:
parent
759fd5c9d5
commit
37b562c4aa
3 changed files with 3 additions and 8 deletions
|
|
@ -42,8 +42,6 @@ export default function createPersistedState({
|
||||||
console.info('waiting for old state to be loaded...')
|
console.info('waiting for old state to be loaded...')
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
} else {
|
} else {
|
||||||
console.log(key, state)
|
|
||||||
debugger
|
|
||||||
return storage.setItem(key, state)
|
return storage.setItem(key, state)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,6 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
// Various migrations
|
// Various migrations
|
||||||
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')) ?? {}
|
||||||
console.log('### sc', vuexState)
|
|
||||||
const config = vuexState.config ?? {}
|
const config = vuexState.config ?? {}
|
||||||
|
|
||||||
const migratedEntries = new Set(config._syncMigration ?? [])
|
const migratedEntries = new Set(config._syncMigration ?? [])
|
||||||
|
|
@ -695,7 +694,6 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
const migrated = migratedEntries.has(key)
|
const migrated = migratedEntries.has(key)
|
||||||
const different = !isEqual(oldValue, defaultValue)
|
const different = !isEqual(oldValue, defaultValue)
|
||||||
|
|
||||||
console.log(key, oldValue)
|
|
||||||
if (present && !migrated && different) {
|
if (present && !migrated && different) {
|
||||||
console.debug(`Migrating config ${key}: ${oldValue}`)
|
console.debug(`Migrating config ${key}: ${oldValue}`)
|
||||||
if (key === 'theme3hacks') {
|
if (key === 'theme3hacks') {
|
||||||
|
|
@ -715,7 +713,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
path: 'fontMonospace',
|
path: 'fontMonospace',
|
||||||
value: oldValue.fonts.monospace,
|
value: oldValue.fonts.monospace,
|
||||||
})
|
})
|
||||||
useSyncConfigStore().set({
|
useSyncConfigStore().setSimplePrefAndSave({
|
||||||
path: 'underlay',
|
path: 'underlay',
|
||||||
value: oldValue.underlay,
|
value: oldValue.underlay,
|
||||||
})
|
})
|
||||||
|
|
@ -746,7 +744,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
|
|
||||||
config._syncMigration = [...migratedEntries]
|
config._syncMigration = [...migratedEntries]
|
||||||
vuexState.config = config
|
vuexState.config = config
|
||||||
//storage.setItem('vuex-lz', vuexState)
|
storage.setItem('vuex-lz', vuexState)
|
||||||
|
|
||||||
if (!needUpload && recent && stale) {
|
if (!needUpload && recent && stale) {
|
||||||
console.debug('Checking if data needs merging...')
|
console.debug('Checking if data needs merging...')
|
||||||
|
|
|
||||||
|
|
@ -292,8 +292,7 @@ export const useUserHighlightStore = defineStore('user_highlight', {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log('### uh', vuexState)
|
storage.setItem('vuex-lz', { ...vuexState, config: { ...config, highlight } })
|
||||||
//storage.setItem('vuex-lz', { ...vuexState, config: { ...config, highlight } })
|
|
||||||
|
|
||||||
if (recent === null) {
|
if (recent === null) {
|
||||||
console.debug(
|
console.debug(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue