Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: do not allow sort by title when groupBy === default

thecodrr36353a4b0c01
diff --git a/packages/core/utils/grouping.js b/packages/core/utils/grouping.js
index 106c065f2..c92339873 100644
--- a/packages/core/utils/grouping.js
+++ b/packages/core/utils/grouping.js
@@ -28,12 +28,14 @@ const KEY_SELECTORS = {
month: (item, groupBy) => months[new Date(item[groupBy]).getMonth()],
week: (item, groupBy) => getWeekGroupFromTimestamp(item[groupBy]),
year: (item, groupBy) => new Date(item[groupBy]).getFullYear().toString(),
- default: (item, groupBy) =>
- item[groupBy] >= TIMESTAMPS.recent()
+ default: (item, groupBy) => {
+ if (groupBy === "title") groupBy = "dateEdited";
+ return item[groupBy] >= TIMESTAMPS.recent()
? "Recent"
: item[groupBy] >= TIMESTAMPS.lastWeek()
? "Last week"
- : "Older",
+ : "Older";
+ },
};
/**