From 539735484b05aec29f063cb62a85ccca4f5e000e Mon Sep 17 00:00:00 2001 From: Gil Cohen <33692883+Gilc83@users.noreply.github.com> Date: Mon, 6 Jan 2025 23:18:44 +0200 Subject: [PATCH] Update click-elements.ts If the history is empty because of a navigation (for example: clicking a link - ), then this prevents an empty state to cause an exception on line 549 in the same function. --- .../src/internals/enqueue-links/click-elements.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright-crawler/src/internals/enqueue-links/click-elements.ts b/packages/playwright-crawler/src/internals/enqueue-links/click-elements.ts index 897e7da974c6..700aa294584b 100644 --- a/packages/playwright-crawler/src/internals/enqueue-links/click-elements.ts +++ b/packages/playwright-crawler/src/internals/enqueue-links/click-elements.ts @@ -544,7 +544,7 @@ async function restoreHistoryNavigationAndSaveCapturedUrls(page: Page, requests: const { stateHistory } = window.history as unknown as ApifyWindow; (window as unknown as Dictionary).history = (window as unknown as Dictionary).__originalHistory__; return stateHistory; - }); + }) ?? []; state.forEach((args) => { try {