From f31306eda0ed33509e050ed7f20665271a0f9a2c Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 13 May 2022 16:26:34 -0500 Subject: [PATCH] Fix:Realtime updates on book cards when changing series sequence #590 --- client/components/cards/LazyBookCard.vue | 29 +++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index b7094b74..dda73474 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -442,7 +442,34 @@ export default { this.isSelectionMode = val if (!val) this.selected = false }, - setEntity(libraryItem) { + setEntity(_libraryItem) { + var libraryItem = _libraryItem + + // this code block is only necessary when showing a selected series with sequence # + // it will update the selected series so we get realtime updates for series sequence changes + if (this.series) { + // i know.. but the libraryItem passed to this func cannot be modified so we need to create a copy + libraryItem = { + ..._libraryItem, + media: { + ..._libraryItem.media, + metadata: { + ..._libraryItem.media.metadata + } + } + } + var mediaMetadata = libraryItem.media.metadata + if (mediaMetadata.series) { + var newSeries = mediaMetadata.series.find((se) => se.id === this.series.id) + if (newSeries) { + // update selected series + libraryItem.media.metadata.series = newSeries + this.libraryItem = libraryItem + return + } + } + } + this.libraryItem = libraryItem }, clickCard(e) {