From 4778d09501ec4fa587e3001bb5b13ac74915d3a3 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 5 Jan 2022 18:01:33 -0600 Subject: [PATCH] Fix:Stream container not opening on mount --- client/components/app/StreamContainer.vue | 2 +- client/components/cards/LazySeriesCard.vue | 1 - client/layouts/default.vue | 14 +++++++++++++- server/utils/libraryHelpers.js | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/client/components/app/StreamContainer.vue b/client/components/app/StreamContainer.vue index 0c5afd09..219267b4 100644 --- a/client/components/app/StreamContainer.vue +++ b/client/components/app/StreamContainer.vue @@ -145,7 +145,7 @@ export default { audioPlayerMounted() { this.audioPlayerReady = true if (this.stream) { - console.log('[STREAM-CONTAINER] audioPlayerMounted w/ Stream', this.stream) + console.log('[STREAM-CONTAINER] audioPlayer Mounted w/ Stream', this.stream) this.openStream() } }, diff --git a/client/components/cards/LazySeriesCard.vue b/client/components/cards/LazySeriesCard.vue index 9f1e7b8d..4fb1dd9a 100644 --- a/client/components/cards/LazySeriesCard.vue +++ b/client/components/cards/LazySeriesCard.vue @@ -74,7 +74,6 @@ export default { }, methods: { setEntity(_series) { - console.log('setting entity', _series) this.series = _series }, setSelectionMode(val) { diff --git a/client/layouts/default.vue b/client/layouts/default.vue index 49cd7c28..67727b84 100644 --- a/client/layouts/default.vue +++ b/client/layouts/default.vue @@ -85,12 +85,24 @@ export default { reconnectFailed() { console.error('[SOCKET] reconnect failed') }, - init(payload) { + init(payload, count = 0) { + if (!this.$refs.streamContainer) { + if (count > 20) { + console.error('Stream container never mounted') + return + } + setTimeout(() => { + this.init(payload, ++count) + }, 100) + return + } console.log('Init Payload', payload) if (payload.stream) { if (this.$refs.streamContainer) { this.$store.commit('setStream', payload.stream) this.$refs.streamContainer.streamOpen(payload.stream) + } else { + console.warn('Stream Container not mounted') } } if (payload.user) { diff --git a/server/utils/libraryHelpers.js b/server/utils/libraryHelpers.js index 978549b6..4a568757 100644 --- a/server/utils/libraryHelpers.js +++ b/server/utils/libraryHelpers.js @@ -118,7 +118,7 @@ module.exports = { userAudiobook: user.getAudiobookJSON(book.id), book } - }) + }).filter(b => !!b.userAudiobook) }, getBooksMostRecentlyRead(booksWithUserAb, limit, minified = false) {