Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Fix race condition in lazy-loaded geo search module (#4486)
Marc Kelechavae55af4b078bf
diff --git a/skyvern-frontend/src/util/geoSearch.ts b/skyvern-frontend/src/util/geoSearch.tsindex 5c0e3f1ff..f54b9e68b 100644--- a/skyvern-frontend/src/util/geoSearch.ts+++ b/skyvern-frontend/src/util/geoSearch.ts@@ -20,13 +20,19 @@ export type GroupedSearchResults = {cities: SearchResultItem[];};-let cscModule: typeof import("country-state-city") | null = null;--async function loadCsc() {- if (!cscModule) {- cscModule = await import("country-state-city");+// Store the promise so concurrent calls share one import+let cscModulePromise: Promise<typeof import("country-state-city")> | null =+ null;++function loadCsc() {+ if (!cscModulePromise) {+ cscModulePromise = import("country-state-city").catch((error) => {+ // Reset on failure so next user action can retry+ cscModulePromise = null;+ throw error;+ });}- return cscModule;+ return cscModulePromise;}export async function searchGeoData(