Skip to content

Commit 33626ac

Browse files
authored
remember playlist selection between the sessions (#7139)
1 parent d6175ae commit 33626ac

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/renderer/store/modules/settings.js

+1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ const state = {
307307
defaultInvidiousInstance: '',
308308
defaultVolume: 1,
309309
uiScale: 100,
310+
userPlaylistsSortBy: 'latest_played_first',
310311
}
311312

312313
const sideEffectHandlers = {

src/renderer/views/UserPlaylists/UserPlaylists.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,18 @@ export default defineComponent({
5252
query: '',
5353
doSearchPlaylistsWithMatchingVideos: false,
5454
activeData: [],
55-
sortBy: SORT_BY_VALUES.LatestPlayedFirst,
5655
}
5756
},
5857
computed: {
58+
sortBy: {
59+
get() {
60+
return this.$store.getters.getUserPlaylistsSortBy
61+
},
62+
set(value) {
63+
this.$store.dispatch('updateUserPlaylistsSortBy', value)
64+
},
65+
},
66+
5967
locale: function () {
6068
return this.$i18n.locale
6169
},
@@ -180,9 +188,6 @@ export default defineComponent({
180188
this.activeData = this.fullData
181189
this.filterPlaylist()
182190
},
183-
sortBy() {
184-
sessionStorage.setItem('UserPlaylists/sortBy', this.sortBy)
185-
},
186191
},
187192
created: function () {
188193
document.addEventListener('keydown', this.keyboardShortcutHandler)
@@ -191,11 +196,6 @@ export default defineComponent({
191196
this.dataLimit = limit
192197
}
193198

194-
const sortBy = sessionStorage.getItem('UserPlaylists/sortBy')
195-
if (sortBy != null) {
196-
this.sortBy = sortBy
197-
}
198-
199199
this.filterPlaylistDebounce = debounce(this.filterPlaylist, 500)
200200

201201
const oldQuery = this.$route.query.searchQueryText ?? ''

0 commit comments

Comments
 (0)