Started investigating default profile loading inconsistency

This commit is contained in:
Luca 2021-03-14 20:18:46 +01:00
parent ca4fc9974f
commit 24d12a4357
5 changed files with 29 additions and 22 deletions

View File

@ -85,7 +85,7 @@ export default Vue.extend({
}
},
mounted: function () {
this.$store.dispatch('grabUserSettings')
this.$store.dispatch('grabUserSettings').then(() => {
this.$store.dispatch('grabHistory')
this.$store.dispatch('grabAllProfiles', this.$t('Profile.All Channels'))
this.$store.dispatch('grabAllPlaylists')
@ -105,6 +105,7 @@ export default Vue.extend({
this.checkForNewUpdates()
this.checkForNewBlogPosts()
}, 500)
})
},
methods: {
checkLocale: function () {

View File

@ -263,6 +263,7 @@ export default Vue.extend({
const currentProfile = JSON.parse(JSON.stringify(this.profileList[this.activeProfile]))
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))
console.log("PRIMARY PROFILE:", primaryProfile)
if (this.isSubscribed) {
currentProfile.subscriptions = currentProfile.subscriptions.filter((channel) => {

View File

@ -13,7 +13,7 @@ if (window && window.process && window.process.type === 'renderer') {
const remote = require('@electron/remote')
dbLocation = remote.app.getPath('userData')
console.log("DB", dbLocation)
dbLocation = dbLocation + '/history.db'
} else {
dbLocation = 'history.db'

View File

@ -27,7 +27,7 @@ const profileDb = new Datastore({
const state = {
profileList: [{
_id: 'allChannels',
name: 'All Channels',
name: 'Brudi Channels',
bgColor: '#000000',
textColor: '#FFFFFF',
subscriptions: []
@ -54,6 +54,7 @@ const actions = {
} else {
// We want the primary profile to always be first
// So sort with that then sort alphabetically by profile name
console.log('PROFILE DB RESULTS', results)
const profiles = results.sort((a, b) => {
if (a._id === 'allChannels') {
return -1
@ -67,10 +68,13 @@ const actions = {
})
if (state.profileList.length < profiles.length) {
console.log("STATE LIST LESS RTHAN PROFILES LENGTH")
console.log(profiles, state.profileList)
console.log("ROOTSTATE:SETTINGDEFATL", rootState.settings.defaultProfile)
const profileIndex = profiles.findIndex((profile) => {
return profile._id === rootState.settings.defaultProfile
})
console.log("INDEX", profileIndex)
if (profileIndex !== -1) {
dispatch('updateActiveProfile', profileIndex)
}
@ -103,7 +107,7 @@ const actions = {
textColor: textColor,
subscriptions: []
}
console.log(defaultProfile)
console.log('DIS DEFAULT', defaultProfile)
profileDb.update({ _id: 'allChannels' }, defaultProfile, { upsert: true }, (err, numReplaced) => {
if (!err) {
dispatch('grabAllProfiles')

View File

@ -280,6 +280,7 @@ const actions = {
commit('setBackendFallback', result.value)
break
case 'defaultProfile':
console.log("IN SETTING DEFAULT:", result.value)
commit('setDefaultProfile', result.value)
break
case 'checkForUpdates':