Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Inconsistent behavior and lack of wait_ and timeout_ options when using app$set_module_input #1169

Closed
3 tasks done
kartikeyakirar opened this issue Mar 20, 2024 · 1 comment · Fixed by #1175
Closed
3 tasks done
Assignees
Labels
bug Something isn't working core

Comments

@kartikeyakirar
Copy link
Contributor

What happened?

I've encountered an issue where using app$set_module_input to set an input value generates console messages, in contrast to the expected behavior seen with app$set_input, which operates without any issues. Although the input value is correctly set when using app$set_module_input, it appears necessary to introduce options for configuring wait_ andtimeout_parameters for app$set_input .

working example

library(teal.modules.helios)
 app <- teal:::TealAppDriver$new(
    data = teal_data(MAE = helios::large_helios_data,
                     code = "MAE <- helios::large_helios_data"),
    modules = tm_g_barplot(
      label = "barplot",
      mae_name = "MAE"
    )
  )

app$set_input(sprintf("%s-%s", app$active_module_ns(), "experiment-name"),"FMI_cna")

app$set_module_input("experiment-name", "FMI_rearr")

set_inputs((function (..., wait_ = TRUE, timeout_ = missing_arg(), allow_no_input_binding_ = FALSE, ): Server did not update any output values within 4 seconds. If this is expected, use `wait_ = FALSE` or increase the value of `timeout_`.
    ▆
 1. └─app$set_module_input("experiment-name", "FMI_rearr")
 2.   └─self$set_input(...) at teal/R/TealAppDriver.R:192:6
 3.     ├─base::do.call(...) at teal/R/TealAppDriver.R:88:6
 4.     └─shinytest2 (local) `<fn>`(`teal-main_ui-root-barplot-module-experiment-name` = "FMI_rearr")
 5.       └─shinytest2:::app_set_inputs(...)
• set_inputs(    priority_ = c("input", "event")) ): Server did not update any output values within 4 seconds. If this is expected, use `wait_ = FALSE` or increase the value of `timeout_`.
    ▆
 1. └─app$set_module_input("experiment-name", "FMI_rearr")
 2.   └─self$set_input(...) at teal/R/TealAppDriver.R:192:6
 3.     ├─base::do.call(...) at teal/R/TealAppDriver.R:88:6
 4.     └─shinytest2 (local) `<fn>`(`teal-main_ui-root-barplot-module-experiment-name` = "FMI_rearr")
 5.       └─shinytest2:::app_set_inputs(...)
• set_inputs({): Server did not update any output values within 4 seconds. If this is expected, use `wait_ = FALSE` or increase the value of `timeout_`.
    ▆
 1. └─app$set_module_input("experiment-name", "FMI_rearr")
 2.   └─self$set_input(...) at teal/R/TealAppDriver.R:192:6
 3.     ├─base::do.call(...) at teal/R/TealAppDriver.R:88:6
 4.     └─shinytest2 (local) `<fn>`(`teal-main_ui-root-barplot-module-experiment-name` = "FMI_rearr")
 5.       └─shinytest2:::app_set_inputs(...)
• set_inputs(    app_set_inputs(self, private, ..., wait_ = wait_, timeout_ = timeout_, ): Server did not update any output values within 4 seconds. If this is expected, use `wait_ = FALSE` or increase the value of `timeout_`.
    ▆
 1. └─app$set_module_input("experiment-name", "FMI_rearr")
 2.   └─self$set_input(...) at teal/R/TealAppDriver.R:192:6
 3.     ├─base::do.call(...) at teal/R/TealAppDriver.R:88:6
 4.     └─shinytest2 (local) `<fn>`(`teal-main_ui-root-barplot-module-experiment-name` = "FMI_rearr")
 5.       └─shinytest2:::app_set_inputs(...)
• set_inputs(        allow_no_input_binding_ = allow_no_input_binding_, priority_ = priority_)): Server did not update any output values within 4 seconds. If this is expected, use `wait_ = FALSE` or increase the value of `timeout_`.
    ▆
 1. └─app$set_module_input("experiment-name", "FMI_rearr")
 2.   └─self$set_input(...) at teal/R/TealAppDriver.R:192:6
 3.     ├─base::do.call(...) at teal/R/TealAppDriver.R:88:6
 4.     └─shinytest2 (local) `<fn>`(`teal-main_ui-root-barplot-module-experiment-name` = "FMI_rearr")
 5.       └─shinytest2:::app_set_inputs(...)
• set_inputs(})(`teal-main_ui-root-barplot-module-experiment-name` = "FMI_rearr")): Server did not update any output values within 4 seconds. If this is expected, use `wait_ = FALSE` or increase the value of `timeout_`.
    ▆
 1. └─app$set_module_input("experiment-name", "FMI_rearr")
 2.   └─self$set_input(...) at teal/R/TealAppDriver.R:192:6
 3.     ├─base::do.call(...) at teal/R/TealAppDriver.R:88:6
 4.     └─shinytest2 (local) `<fn>`(`teal-main_ui-root-barplot-module-experiment-name` = "FMI_rearr")
 5.       └─shinytest2:::app_set_inputs(...)

sessionInfo()

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
@kartikeyakirar kartikeyakirar added bug Something isn't working core labels Mar 20, 2024
@averissimo
Copy link
Contributor

averissimo commented Mar 21, 2024

You can parametrize this by adding timeout argument to constructor.

We've been using 20 (20 seconds) to wait for the UI to update, I believe you can use the same here without specifying it on the call itself.

app <- teal:::TealAppDriver$new(
  data = teal_data(MAE = helios::large_helios_data,
                   code = "MAE <- helios::large_helios_data"),
  modules = tm_g_barplot(
    label = "barplot",
    mae_name = "MAE"
  ),
  timeout = 20
)

Although you bring an interesting point, that the new API should accept extra arguments and pass those along to customize the calls

  wait_ = TRUE,
  timeout_ = missing_arg(),
  allow_no_input_binding_ = FALSE,
  priority_ = c("input", "event")

@averissimo averissimo self-assigned this Mar 21, 2024
vedhav pushed a commit that referenced this issue Apr 1, 2024
… (shinytest2) (#1175)

# Pull Request

<!--- Replace `#nnn` with your issue link for reference. -->

Fixes #1169 

### Changes description

- Added upstream parameters on `TealAppDriver` methods that use
`AppDriver$set_inputs`

---------

Signed-off-by: André Veríssimo <[email protected]>
Co-authored-by: kartikeya kirar <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core
Projects
None yet
2 participants