diff --git a/client/src/components/History/HistoryScrollList.vue b/client/src/components/History/HistoryScrollList.vue index 320fd832d70..c0ddb0d9573 100644 --- a/client/src/components/History/HistoryScrollList.vue +++ b/client/src/components/History/HistoryScrollList.vue @@ -148,6 +148,10 @@ const filtered = computed(() => { return -1; } else if (!isMultiviewPanel.value && b.id == currentHistoryId.value) { return 1; + } else if (isMultiviewPanel.value && isPinned(a.id) && !isPinned(b.id)) { + return -1; + } else if (isMultiviewPanel.value && !isPinned(a.id) && isPinned(b.id)) { + return 1; } else if (a.update_time < b.update_time) { return 1; } else { @@ -161,16 +165,20 @@ const isMultiviewPanel = computed(() => !props.inModal && props.multiple); function isActiveItem(history: HistorySummary) { if (isMultiviewPanel.value) { - return pinnedHistories.value.some((item: PinnedHistory) => item.id == history.id); + return isPinned(history.id); } else { return props.selectedHistories.some((item: PinnedHistory) => item.id == history.id); } } +function isPinned(historyId: string) { + return pinnedHistories.value.some((item: PinnedHistory) => item.id == historyId); +} + function historyClicked(history: HistorySummary) { emit("selectHistory", history); if (isMultiviewPanel.value) { - if (pinnedHistories.value.some((item: PinnedHistory) => item.id == history.id)) { + if (isPinned(history.id)) { historyStore.unpinHistories([history.id]); } else { openInMulti(history); @@ -263,7 +271,7 @@ async function loadMore(noScroll = false) { (Current) (currently pinned)