From e029220348bbeb2a31ad398ccaba8b2896674ae8 Mon Sep 17 00:00:00 2001 From: Akhilesh Thite Date: Tue, 4 Jun 2024 01:18:31 +0530 Subject: [PATCH] fix: pass dynamic sort parameter for random note fetching in timeline --- .vscode/settings.json | 3 +++ timeline.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/timeline.js b/timeline.js index d746d00..fb7a685 100644 --- a/timeline.js +++ b/timeline.js @@ -95,7 +95,7 @@ class ReaderTimeline extends HTMLElement { let count = 0 if (this.sort === 'random') { - for await (const note of db.searchNotes({ limit: this.limit })) { + for await (const note of db.searchNotes({}, { limit: this.limit, sort: this.sort === 'random' ? 0 : (this.sort === 'oldest' ? 1 : -1) })) { this.appendNoteElement(note) count++ }