File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class MemosSync {
51
51
await this . choosingClient ( ) ;
52
52
if ( this . memosClient === undefined || this . memosClient === null ) {
53
53
logseq . UI . showMsg ( "Memos Sync Setup issue" , "error" ) ;
54
- return
54
+ return ;
55
55
}
56
56
try {
57
57
await this . sync ( ) ;
@@ -84,16 +84,22 @@ class MemosSync {
84
84
private async sync ( ) {
85
85
await this . beforeSync ( ) ;
86
86
87
+ if ( this . memosClient === undefined || this . memosClient === null ) {
88
+ await this . choosingClient ( ) ;
89
+ }
90
+
87
91
let maxMemoId = await this . lastSyncId ( ) ;
88
92
let newMaxMemoId = maxMemoId ;
89
93
let end = false ;
90
94
let cousor = 0 ;
95
+
91
96
while ( ! end ) {
92
97
const memos = await this . memosClient ! . getMemos (
93
98
BATCH_SIZE ,
94
99
cousor ,
95
100
this . includeArchive !
96
101
) ;
102
+
97
103
for ( const memo of this . memosFitler ( memos ) ) {
98
104
if ( memo . id <= maxMemoId ) {
99
105
end = true ;
@@ -220,6 +226,9 @@ class MemosSync {
220
226
}
221
227
222
228
private memosFitler ( memos : Array < Memo > ) : Array < Memo > {
229
+ if ( ! memos ) {
230
+ return [ ]
231
+ }
223
232
return memos . filter ( ( memo ) => {
224
233
if ( this . tagFilterList ! . length === 0 ) {
225
234
return true ;
You can’t perform that action at this time.
0 commit comments