Skip to content

Commit 8a49c79

Browse files
authored
Merge pull request #33 from omnivore-app/sort-by-savedAt
feat: sort articles by savedAt
2 parents e404f1a + 0c83cd8 commit 8a49c79

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ const fetchOmnivore = async (
9494

9595
const displaySiteName =
9696
article.siteName || siteNameFromUrl(article.originalArticleUrl)
97-
console.log('display site name', displaySiteName)
9897
if (displaySiteName) {
9998
content += `\nsite:: [${displaySiteName}](${article.originalArticleUrl})`
10099
}
@@ -118,9 +117,9 @@ const fetchOmnivore = async (
118117
const existingBlocks = await logseq.DB.q<BlockEntity>(
119118
`"${article.slug}"`
120119
)
121-
if (existingBlocks && existingBlocks.length > 0) {
120+
if (existingBlocks) {
122121
for (const block of existingBlocks) {
123-
await logseq.Editor.removeBlock(block.uuid)
122+
block.uuid && (await logseq.Editor.removeBlock(block.uuid))
124123
}
125124
}
126125

src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const loadArticles = async (
7373
},
7474
body: `{"query":"\\n query Search($after: String, $first: Int, $query: String) {\\n search(first: $first, after: $after, query: $query) {\\n ... on SearchSuccess {\\n edges {\\n node {\\n title\\n slug\\n siteName\\n originalArticleUrl\\n url\\n author\\n updatedAt\\n description\\n savedAt\\n highlights {\\n id\\n quote\\n annotation\\n }\\n labels {\\n name\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n }\\n }\\n ... on SearchError {\\n errorCodes\\n }\\n }\\n }\\n ","variables":{"after":"${after}","first":${first}, "query":"${
7575
updatedAt ? 'updated:' + updatedAt : ''
76-
} sort:updated-asc ${filter}"}}`,
76+
} sort:saved-asc ${filter}"}}`,
7777
method: 'POST',
7878
})
7979

0 commit comments

Comments
 (0)