@@ -136,9 +136,9 @@ export const gif = (() => {
136
136
<div onclick="undangan.comment.gif.click('${ ctx . uuid } ', '${ id } ', '${ util . base64Encode ( url ) } ')" class="gif-checklist position-absolute justify-content-center align-items-center top-0 end-0 bg-overlay-auto p-1 m-1 rounded-circle border shadow-sm z-1">
137
137
<i class="fa-solid fa-circle-check"></i>
138
138
</div>
139
- <img src="${ uri } " class="img-fluid" alt="${ description } " style="width: 100%;">
139
+ <img src="${ uri } " class="img-fluid" alt="${ util . escapeHtml ( description ) } " style="width: 100%;">
140
140
</figure>
141
- ` ) ;
141
+ ` ) ;
142
142
} ) ;
143
143
}
144
144
k ++ ;
@@ -181,9 +181,10 @@ export const gif = (() => {
181
181
* @returns {Promise<void> }
182
182
*/
183
183
const render = async ( ctx , reqCancel , response ) => {
184
+ let run = true ;
185
+
184
186
ctx . last = new Promise ( ( res ) => {
185
187
const load = loading ( ctx ) ;
186
- let run = true ;
187
188
188
189
( async ( ) => {
189
190
await reqCancel ;
@@ -207,10 +208,10 @@ export const gif = (() => {
207
208
} else {
208
209
alert ( err ) ;
209
210
}
211
+ } finally {
212
+ load . release ( ) ;
213
+ res ( ) ;
210
214
}
211
-
212
- load . release ( ) ;
213
- res ( ) ;
214
215
} ) ( ) ;
215
216
} ) ;
216
217
} ;
@@ -258,6 +259,11 @@ export const gif = (() => {
258
259
* @returns {Promise<void> }
259
260
*/
260
261
const infinite = async ( ctx ) => {
262
+ // Don't try to load more if there's no next page token
263
+ if ( ! ctx . next || ctx . next . length === 0 ) {
264
+ return ;
265
+ }
266
+
261
267
const isQuery = ctx . query && ctx . query . trim ( ) . length ;
262
268
const params = { pos : ctx . next , limit : ctx . limit } ;
263
269
@@ -498,7 +504,20 @@ export const gif = (() => {
498
504
* @param {string|null } uuid
499
505
* @returns {void }
500
506
*/
501
- const remove = ( uuid = null ) => uuid ? objectPool . delete ( uuid ) : objectPool . clear ( ) ;
507
+ const remove = ( uuid = null ) => {
508
+ if ( uuid ) {
509
+ if ( objectPool . has ( uuid ) ) {
510
+ objectPool . get ( uuid ) . reqs . forEach ( f => f ( ) ) ;
511
+
512
+ objectPool . delete ( uuid ) ;
513
+ queue . delete ( uuid ) ;
514
+ }
515
+ } else {
516
+ objectPool . forEach ( ( ses ) => ses . reqs . forEach ( f => f ( ) ) ) ;
517
+ objectPool . clear ( ) ;
518
+ queue . clear ( ) ;
519
+ }
520
+ } ;
502
521
503
522
/**
504
523
* @param {string } uuid
0 commit comments