Skip to content

Commit 8568497

Browse files
authored
Eslint: Remove function appCommWaiter (dead code) (#2001)
## Context I open this PR while working on #2000. Eslint reports an accurate issue with `waitForActiveRequests()`. While digging, I found that `appCommWaiter()` function had a implementation problem: it used `waitForActiveRequests()` which supposedly awaited for pending request to end. But the object awaited was not a promise and the result was resolved immediately. Also this function does not seem to be used elsewhere (at least from what I have found in grist-core). ## Proposed solution 1. Remove `appCommWaiter` which does not seem to be used. 2. Remove `waitForActiveRequests` which was only used in the above function ## Related issues #1967 ## Has this been tested? <!-- Put an `x` in the box that applies: --> - [ ] 👍 yes, I added tests to the test suite - [ ] 💭 no, because this PR is a draft and still needs work - [x] 🙅 no, because this is not relevant here - [ ] 🙋 no, because I need help <!-- Detail how we can help you --> ## Screenshots / Screencasts <!-- delete if not relevant -->
1 parent a804d8d commit 8568497

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

app/client/components/Comm.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,6 @@ export class Comm extends dispose.Disposable implements GristServerAPI, DocListA
221221
return this.pendingRequests.size !== 0;
222222
}
223223

224-
/**
225-
* Wait for all active requests to complete.
226-
*/
227-
public async waitForActiveRequests(): Promise<void> {
228-
await Promise.all(this.pendingRequests.values());
229-
}
230-
231224
/**
232225
* Internal implementation of all the server methods. They differ only in the name of the server
233226
* method to call, and the arguments that it expects.

test/client/clientUtil.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,6 @@ function querySelectorLast(el, selector) {
9191
}
9292
exports.querySelectorLast = querySelectorLast;
9393

94-
var SERVER_TIMEOUT = 250; // How long to wait for pending requests to resolve
95-
var CLIENT_DELAY = 100; // How long to wait for browser to render the action
96-
97-
function appCommWaiter(app) {
98-
return function(timeout, delay) {
99-
return Promise.resolve(app.comm.waitForActiveRequests())
100-
.timeout(timeout || SERVER_TIMEOUT)
101-
.delay(delay || CLIENT_DELAY);
102-
};
103-
}
104-
exports.appCommWaiter = appCommWaiter;
105-
10694
/*
10795
*
10896
* Takes and observable and returns a promise when the observable changes.

0 commit comments

Comments
 (0)