option to allow overwriting timeline extremes with newer values

This commit is contained in:
Henry Jameson 2026-08-31 19:33:55 +03:00
commit f2f15a0c02

View file

@ -414,7 +414,7 @@ export const useTimelinesStore = defineStore('timelines', {
},
// Queues & Timeline manip
updateTimelineExtremes(timeline, pagination = {}) {
updateTimelineExtremes(timeline, pagination = {}, force = false) {
// Can't use Math.min/max because it doesn't work with string (duh)
const minNew = pagination.maxId ?? last(timeline.order) ?? ''
const maxNew = pagination.minId ?? first(timeline.order) ?? ''
@ -422,10 +422,10 @@ export const useTimelinesStore = defineStore('timelines', {
const newer = maxNew > timeline.maxId
const older = minNew < timeline.minId
if (newer || timeline.maxId === '') {
if (force || newer || timeline.maxId === '') {
timeline.maxId = maxNew
}
if (older || timeline.minId === '') {
if (force || older || timeline.minId === '') {
timeline.minId = minNew
}
@ -442,7 +442,7 @@ export const useTimelinesStore = defineStore('timelines', {
timeline.visibleStatusIds = new Set([
...timeline.order.filter((id) => !timeline.ignoredIds.has(id)),
])
this.updateTimelineExtremes(timeline)
this.updateTimelineExtremes(timeline, {}, true)
},
syncOrder(timeline) {
timeline.order = timeline.order.filter((id) => timeline.statusIds.has(id))