Skip to content

Commit 6c42f4c

Browse files
committed
fix: Only enter if-block (and click 'customize') when 'customize' is present
handlePuppetReady() is called very often and in parallel Removing the sleep(1000) the condition (can I click?) and action (I do click) are closer to each other and we have less chance for a race condition.
1 parent 92948e9 commit 6c42f4c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/middleware/bot.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,13 @@ export default (store: Store & { dispatch: Dispatch }) =>
5959
(await electronUtils.elementExists(
6060
'#uc-center-container',
6161
cookiePopupRootSelector
62+
)) &&
63+
(await electronUtils.elementExists(
64+
'[data-testid="uc-customize-button"]',
65+
cookiePopupRootSelector
6266
))
6367
) {
6468
store.dispatch(setBotMessage('🍪⁉️'));
65-
await sleep(1000);
6669
await electronUtils.click(
6770
'[data-testid="uc-customize-button"]',
6871
cookiePopupRootSelector

0 commit comments

Comments
 (0)