mirror of
https://github.com/zadam/trilium.git
synced 2025-12-31 11:44:23 +01:00
fix(window): Fix incorrect noteContents error
This commit is contained in:
parent
537c4051cc
commit
5d39b84886
@ -59,7 +59,7 @@ export default class TabManager extends Component {
|
||||
windowId: appContext.windowId,
|
||||
createdAt: Date.now(),
|
||||
closedAt: null,
|
||||
contexts: savedWindows
|
||||
contexts: openNoteContexts
|
||||
});
|
||||
}
|
||||
|
||||
@ -135,17 +135,17 @@ export default class TabManager extends Component {
|
||||
|
||||
// Save window contents
|
||||
if (currentWin) {
|
||||
currentWin.createdAt = Date.now(),
|
||||
currentWin.createdAt = Date.now();
|
||||
currentWin.closedAt = null;
|
||||
currentWin.contexts = filteredNoteContexts;
|
||||
} else {
|
||||
// Filter out the oldest entry (excluding the main window)
|
||||
if (savedWindows.length >= 10) {
|
||||
if (savedWindows?.length >= 10) {
|
||||
const candidates = savedWindows.filter(w => w.windowId !== "main");
|
||||
const oldestIndex = candidates.reduce((a, b) =>
|
||||
const oldest = candidates.reduce((a, b) =>
|
||||
a.createdAt < b.createdAt ? a : b
|
||||
);
|
||||
savedWindows.splice(savedWindows.indexOf(oldestIndex), 1);
|
||||
savedWindows.splice(savedWindows.indexOf(oldest), 1);
|
||||
}
|
||||
savedWindows.push({
|
||||
windowId: appContext.windowId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user