Skip to content

Commit a1cb65c

Browse files
committed
simpler flush all
1 parent 129f82c commit a1cb65c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/pages/chat/pending-callbacks.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ window.__usePendingCallbacks = false;
1313
window.__pendingCallbacks = [];
1414
window.__flushOne = () => window.__pendingCallbacks.shift()?.();
1515
window.__flushAll = () => {
16-
for (const callback of window.__pendingCallbacks) {
17-
callback();
16+
while (window.__pendingCallbacks.length) {
17+
window.__flushOne();
1818
}
19-
window.__pendingCallbacks = [];
2019
};
2120

2221
export const asyncCallback = (callback: () => void, delay: number) => {

test/e2e/page/chat-page-object.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export default class ChatPageObject extends BaseExamplePage {
2626
await this.browser.execute(() => (window.__usePendingCallbacks = true));
2727
}
2828
async flushOne() {
29-
await this.browser.execute(() => window.__flushOne());
29+
await this.browser.execute(() => {
30+
window.__flushOne();
31+
});
3032
}
3133

3234
countChatBubbles() {

0 commit comments

Comments
 (0)