From bac604840a626269d59b36536a6f37948c961521 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 14:24:12 +0000 Subject: [PATCH 1/2] Initial plan From 6d3fb97789c3937c2871c44a363651d81deebe33 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 14:26:01 +0000 Subject: [PATCH 2/2] Add configurable sleep_time parameter to set_active_ns function Co-authored-by: osenan <35930244+osenan@users.noreply.github.com> --- R/TealAppDriver.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/TealAppDriver.R b/R/TealAppDriver.R index 96b1e7224..da36404ef 100644 --- a/R/TealAppDriver.R +++ b/R/TealAppDriver.R @@ -572,7 +572,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name. length(wrapper_id) > 0 && !(length(wrapper_id) == 1 && (wrapper_id == "" || is.na(wrapper_id))) }, - set_active_ns = function() { + set_active_ns = function(sleep_time = 0.5) { # Although wait_for_idle() is called before set_active_ns(), it only ensures Shiny is not processing. # wait_for_page_stability() is needed here to ensure the DOM/UI is fully rendered and stable # before trying to extract the namespace. @@ -602,7 +602,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name. # get_attr returns character(0) when no elements found, or NA_character_ for missing attributes if (!private$is_valid_wrapper_id(active_wrapper_id)) { # Try one more time after a short wait - the page might still be loading - Sys.sleep(0.5) + Sys.sleep(sleep_time) active_wrapper_id <- private$extract_wrapper_id( ".teal-modules-tree li a.module-button[href*='-wrapper']:not([href='#'])" )