From 3e3059d79abd3e93f53bea607d061f4ca83141f7 Mon Sep 17 00:00:00 2001 From: Ajay Date: Sun, 11 Dec 2022 16:58:40 -0500 Subject: [PATCH] Fix bar being too long due to time to decimal changing while remaking bar not true --- src/js-components/previewBar.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index 3d26cbdd..4842afc0 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -374,26 +374,24 @@ class PreviewBar { return; } - if (remakingBar) { - const filteredSegments = segments?.filter((segment) => this.chapterFilter(segment)); - if (filteredSegments) { - let groups = this.unfilteredChapterGroups; - if (filteredSegments.length !== segments.length) { - groups = this.createChapterRenderGroups(filteredSegments); - } - this.chapterGroups = groups.filter((segment) => this.chapterGroupFilter(segment)); + const filteredSegments = segments?.filter((segment) => this.chapterFilter(segment)); + if (filteredSegments) { + let groups = this.unfilteredChapterGroups; + if (filteredSegments.length !== segments.length) { + groups = this.createChapterRenderGroups(filteredSegments); + } + this.chapterGroups = groups.filter((segment) => this.chapterGroupFilter(segment)); - if (groups.length !== this.chapterGroups.length) { - // Fix missing sections due to filtered segments - for (let i = 1; i < this.chapterGroups.length; i++) { - if (this.chapterGroups[i].segment[0] !== this.chapterGroups[i - 1].segment[1]) { - this.chapterGroups[i - 1].segment[1] = this.chapterGroups[i].segment[0] - } + if (groups.length !== this.chapterGroups.length) { + // Fix missing sections due to filtered segments + for (let i = 1; i < this.chapterGroups.length; i++) { + if (this.chapterGroups[i].segment[0] !== this.chapterGroups[i - 1].segment[1]) { + this.chapterGroups[i - 1].segment[1] = this.chapterGroups[i].segment[0] } } - } else { - this.chapterGroups = this.unfilteredChapterGroups; } + } else { + this.chapterGroups = this.unfilteredChapterGroups; } if (!this.chapterGroups || this.chapterGroups.length <= 0) {