1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Revert "Desktop: Fixes #5686: Fixed Tags Order (#6136)"

This reverts commit 07f128ae95.

Due to regression: https://github.com/laurent22/joplin/issues/6301
This commit is contained in:
Laurent Cozic
2022-03-28 17:40:51 +01:00
parent a73d822998
commit 3725b14e04
5 changed files with 34 additions and 47 deletions

View File

@ -1,7 +1,6 @@
const Folder = require('../../models/Folder').default;
const Setting = require('../../models/Setting').default;
const BaseModel = require('../../BaseModel').default;
const Tag = require('../../models/Tag').default;
const shared = {};
@ -51,7 +50,20 @@ shared.renderFolders = function(props, renderItem) {
};
shared.renderTags = function(props, renderItem) {
const tags = Tag.sortTags(props.tags.slice());
const tags = props.tags.slice();
tags.sort((a, b) => {
// It seems title can sometimes be undefined (perhaps when syncing
// and before tag has been decrypted?). It would be best to find
// the root cause but for now that will do.
//
// Fixes https://github.com/laurent22/joplin/issues/4051
if (!a || !a.title || !b || !b.title) return 0;
// Note: while newly created tags are normalized and lowercase
// imported tags might be any case, so we need to do case-insensitive
// sort.
return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : +1;
});
const tagItems = [];
const order = [];
for (let i = 0; i < tags.length; i++) {