Revert "Store: Implement history synchronization between windows"

This reverts commit 99b61e6178.

This is necessary for an upcoming improved implementation of the
history synchronization.
This commit is contained in:
Svallinn 2021-10-17 03:21:28 +01:00
parent d5d00fdb04
commit 15e27bf564
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
2 changed files with 5 additions and 24 deletions

View File

@ -1,7 +1,5 @@
import { historyDb } from '../datastores'
import { IpcChannels } from '../../../constants'
const state = {
historyCache: []
}
@ -18,7 +16,7 @@ const actions = {
commit('setHistoryCache', results)
},
updateHistory({ commit, dispatch }, record) {
updateHistory({ commit }, record) {
historyDb.update(
{ videoId: record.videoId },
record,
@ -26,32 +24,21 @@ const actions = {
).catch(console.error)
commit('upsertToHistoryCache', record)
dispatch('propagateHistory')
},
removeFromHistory({ commit, dispatch }, videoId) {
removeFromHistory({ commit }, videoId) {
historyDb.remove({ videoId: videoId }).catch(console.error)
commit('removeFromHistoryCacheById', videoId)
dispatch('propagateHistory')
},
removeAllHistory({ commit, dispatch }) {
removeAllHistory({ commit }) {
historyDb.remove({}, { multi: true }).catch(console.error)
commit('setHistoryCache', [])
dispatch('propagateHistory')
},
updateWatchProgress({ commit, dispatch }, { videoId, watchProgress }) {
updateWatchProgress({ commit }, { videoId, watchProgress }) {
historyDb.update({ videoId }, { $set: { watchProgress } }, { upsert: true }).catch(console.error)
commit('updateRecordWatchProgressInHistoryCache', { videoId, watchProgress })
dispatch('propagateHistory')
},
propagateHistory({ getters: { getUsingElectron: usingElectron } }) {
if (usingElectron) {
const { ipcRenderer } = require('electron')
ipcRenderer.send(IpcChannels.SYNC_HISTORY, state.historyCache)
}
},
compactHistory(_) {

View File

@ -341,13 +341,7 @@ const customActions = {
})
ipcRenderer.on(IpcChannels.SYNC_HISTORY, (_, payload) => {
// Payload is the entire history => array of history entries
/*
* FIXME: Depending on how big the history size is, this could
* potentially become slow. While I'm sure there isn't a problem
* with this approach, I believe this can be done better.
*/
commit('setHistoryCache', payload)
// TODO: Not implemented
})
ipcRenderer.on(IpcChannels.SYNC_PROFILES, (_, __) => {