mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop: Fixed: The side bar was being refreshed too frequently. Fixed: Order of notebooks with sub-notebooks was sometimes incorrect when sorting by last updated time.
This commit is contained in:
parent
23e6e6e69d
commit
68fbe8125e
@ -99,6 +99,30 @@ describe('models_Folder', function() {
|
||||
expect(folders[0].id).toBe(f1.id);
|
||||
expect(folders[1].id).toBe(f3.id);
|
||||
expect(folders[2].id).toBe(f2.id);
|
||||
|
||||
let n2 = await Note.save({ title: 'note2', parent_id: f2.id });
|
||||
folders = await Folder.orderByLastModified(await Folder.all(), 'desc');
|
||||
|
||||
expect(folders[0].id).toBe(f2.id);
|
||||
expect(folders[1].id).toBe(f1.id);
|
||||
expect(folders[2].id).toBe(f3.id);
|
||||
|
||||
await Note.save({ id: n1.id, title: 'note1 MOD' });
|
||||
|
||||
folders = await Folder.orderByLastModified(await Folder.all(), 'desc');
|
||||
expect(folders[0].id).toBe(f1.id);
|
||||
expect(folders[1].id).toBe(f3.id);
|
||||
expect(folders[2].id).toBe(f2.id);
|
||||
|
||||
let f4 = await Folder.save({ title: "folder4", parent_id: f1.id }); await sleep(0.1);
|
||||
let n3 = await Note.save({ title: 'note3', parent_id: f4.id });
|
||||
|
||||
folders = await Folder.orderByLastModified(await Folder.all(), 'desc');
|
||||
expect(folders.length).toBe(4);
|
||||
expect(folders[0].id).toBe(f4.id);
|
||||
expect(folders[1].id).toBe(f1.id);
|
||||
expect(folders[2].id).toBe(f3.id);
|
||||
expect(folders[3].id).toBe(f2.id);
|
||||
}));
|
||||
|
||||
});
|
@ -310,7 +310,9 @@ class BaseApplication {
|
||||
SearchEngine.instance().scheduleSyncTables();
|
||||
}
|
||||
|
||||
if (this.hasGui() && ["FOLDER_UPDATE_ONE", "FOLDER_UPDATE_ALL"].indexOf(action.type) >= 0) {
|
||||
// Don't add FOLDER_UPDATE_ALL as refreshFolders() is calling it too, which
|
||||
// would cause the sidebar to refresh all the time.
|
||||
if (this.hasGui() && ["FOLDER_UPDATE_ONE"].indexOf(action.type) >= 0) {
|
||||
refreshFolders = true;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,12 @@ class Folder extends BaseItem {
|
||||
const parent = findFolderParent(folderId);
|
||||
if (!parent) return;
|
||||
|
||||
folderIdToTime[parent.id] = folderIdToTime[folderId];
|
||||
if (folderIdToTime[parent.id] && folderIdToTime[parent.id] >= folderIdToTime[folderId]) {
|
||||
// Don't change so that parent has the same time as the last updated child
|
||||
} else {
|
||||
folderIdToTime[parent.id] = folderIdToTime[folderId];
|
||||
}
|
||||
|
||||
applyChildTimeToParent(parent.id);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user