mirror of
https://github.com/zadam/trilium.git
synced 2026-01-01 04:04:25 +01:00
chore(window): use MAX_SAVED_WINDOWS constant
This commit is contained in:
parent
5d39b84886
commit
0af7b8b145
@ -11,6 +11,8 @@ import linkService from "../services/link.js";
|
||||
import type { EventData } from "./app_context.js";
|
||||
import type FNote from "../entities/fnote.js";
|
||||
|
||||
const MAX_SAVED_WINDOWS = 10;
|
||||
|
||||
interface TabState {
|
||||
contexts: NoteContext[];
|
||||
position: number;
|
||||
@ -140,7 +142,7 @@ export default class TabManager extends Component {
|
||||
currentWin.contexts = filteredNoteContexts;
|
||||
} else {
|
||||
// Filter out the oldest entry (excluding the main window)
|
||||
if (savedWindows?.length >= 10) {
|
||||
if (savedWindows?.length >= MAX_SAVED_WINDOWS) {
|
||||
const candidates = savedWindows.filter(w => w.windowId !== "main");
|
||||
const oldest = candidates.reduce((a, b) =>
|
||||
a.createdAt < b.createdAt ? a : b
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user