Skip to content

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

fix: notes not being sorted properly

thecodrr787c67929286
diff --git a/packages/core/api/database.js b/packages/core/api/database.js
index c16ddb36d..002436ca1 100644
--- a/packages/core/api/database.js
+++ b/packages/core/api/database.js
@@ -49,15 +49,15 @@ class Database {
getNotes() {
checkInitialized.call(this);
- return extractValues(this.notes);
+ return extractValues(this.notes).reverse();
}
getFavorites() {
- return tfun.filter(".favorite == true")(extractValues(this.notes));
+ return tfun.filter(".favorite == true")(this.getNotes());
}
getPinned() {
- return tfun.filter(".pinned == true")(extractValues(this.notes));
+ return tfun.filter(".pinned == true")(this.getNotes());
}
/**
diff --git a/packages/core/utils/index.js b/packages/core/utils/index.js
index 1408c521c..411cb8b80 100644
--- a/packages/core/utils/index.js
+++ b/packages/core/utils/index.js
@@ -41,7 +41,7 @@ function groupBySpecial(arr, key) {
let index = _groups[k] === undefined ? i : _groups[k].index;
let groupIndex =
_groups[k] == undefined ? groupCounts.length : _groups[k].groupIndex;
- retVal.splice(index, 0, val);
+ retVal.splice(index + 1, 0, val);
groupCounts[groupIndex] =
groupCounts.length == groupIndex ? 1 : groupCounts[groupIndex] + 1;
groups[groupIndex] = { title: k };