From 706b2d7d7262890931b15a1bd88754803a641f68 Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sat, 22 Feb 2025 21:50:09 -0700 Subject: [PATCH] Add: store for filtered podcast episodes --- client/components/tables/podcast/LazyEpisodesTable.vue | 7 +++++++ client/store/index.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/client/components/tables/podcast/LazyEpisodesTable.vue b/client/components/tables/podcast/LazyEpisodesTable.vue index 8821ccef..0e62e9e4 100644 --- a/client/components/tables/podcast/LazyEpisodesTable.vue +++ b/client/components/tables/podcast/LazyEpisodesTable.vue @@ -89,6 +89,13 @@ export default { handler() { this.refresh() } + }, + episodesList: { + handler(newList) { + const episodeIds = newList.map((ep) => ep.id) + this.$store.commit('setSortedEpisodeIds', episodeIds) + }, + immediate: true } }, computed: { diff --git a/client/store/index.js b/client/store/index.js index 2f2201b6..accf931d 100644 --- a/client/store/index.js +++ b/client/store/index.js @@ -25,6 +25,7 @@ export const state = () => ({ previousPath: '/', bookshelfBookIds: [], episodeTableEpisodeIds: [], + sortedEpisodeIds: [], openModal: null, innerModalOpen: false, lastBookshelfScrollData: {}, @@ -61,6 +62,9 @@ export const getters = { getHomeBookshelfView: (state) => { if (!state.serverSettings || isNaN(state.serverSettings.homeBookshelfView)) return Constants.BookshelfView.STANDARD return state.serverSettings.homeBookshelfView + }, + getSortedEpisodeIds: (state) => { + return state.sortedEpisodeIds || [] } } @@ -146,6 +150,9 @@ export const mutations = { setEpisodeTableEpisodeIds(state, val) { state.episodeTableEpisodeIds = val || [] }, + setSortedEpisodeIds(state, episodeIds) { + state.sortedEpisodeIds = episodeIds || [] + }, setPreviousPath(state, val) { state.previousPath = val },