File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ export class HistoryService {
29
29
} ) ;
30
30
} ,
31
31
} ) . withUpdater ( ( old , next , trigger ) => {
32
+ /**
33
+ * Manual updates, always accept the update
34
+ */
32
35
if ( trigger === 'manual' ) {
33
36
return next ;
34
37
}
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ export class Service {
201
201
}
202
202
203
203
class NonOverlapping {
204
- /** @type {null|{promise: any} } */
204
+ /** @type {null|{promise: any, id: string } } */
205
205
_ongoing = null ;
206
206
207
207
/**
@@ -219,12 +219,19 @@ class NonOverlapping {
219
219
if ( this . _ongoing ?. promise ) {
220
220
this . _ongoing . promise . cancelled = true ;
221
221
}
222
+ // todo: where to put this de-duplication of queries?
223
+ const id = JSON . stringify ( params ) ;
224
+ if ( this . _ongoing ?. id === id ) {
225
+ return ;
226
+ }
227
+
222
228
// eslint-disable-next-line promise/prefer-await-to-then
223
229
const promise = this . service . impl . initial ( params ) . then ( ( data ) => {
224
230
if ( /** @type {any } */ ( promise ) . cancelled ) return ;
225
231
this . service . accept ( data , 'trigger-fetch' ) ;
226
232
this . _ongoing = null ;
227
233
} ) ;
228
- this . _ongoing = { promise } ;
234
+
235
+ this . _ongoing = { promise, id } ;
229
236
}
230
237
}
You can’t perform that action at this time.
0 commit comments