mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
fix: do not get undefined items
This commit is contained in:
@@ -4,10 +4,16 @@ import {
|
||||
notebookTest,
|
||||
TEST_NOTE,
|
||||
TEST_NOTEBOOK,
|
||||
databaseTest,
|
||||
} from "./utils";
|
||||
|
||||
beforeEach(() => StorageInterface.clear());
|
||||
|
||||
test("trash should be empty", () =>
|
||||
databaseTest().then((db) => {
|
||||
expect(db.trash.all.length).toBe(0);
|
||||
}));
|
||||
|
||||
test("permanently delete a note", () =>
|
||||
noteTest().then(async ({ db, id }) => {
|
||||
const note = db.notes.note(id);
|
||||
|
||||
@@ -79,7 +79,7 @@ export default class CachedCollection {
|
||||
getAllItems(sortFn = (u) => u.dateCreated) {
|
||||
let items = [];
|
||||
this.map.forEach((value) => {
|
||||
if (value.deleted) return;
|
||||
if (!value || value.deleted) return;
|
||||
items[items.length] = value;
|
||||
});
|
||||
return sort(items).desc(sortFn);
|
||||
|
||||
Reference in New Issue
Block a user