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

Handle delayed choices #256

Merged
merged 8 commits into from
Feb 14, 2024
41 changes: 29 additions & 12 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ tm_g_gh_boxplot <- function(label,
plot_height = plot_height,
plot_width = plot_width,
hline_vars_colors = hline_vars_colors,
hline_vars_labels = hline_vars_labels
hline_vars_labels = hline_vars_labels,
module_args = args
),
ui = ui_g_boxplot,
ui_args = args
Expand Down Expand Up @@ -251,16 +252,7 @@ ui_g_boxplot <- function(id, ...) {
selected = a$trt_group$selected,
multiple = FALSE
),
templ_ui_params_vars(
ns,
xparam_choices = a$param$choices,
xparam_selected = a$param$selected,
xparam_label = "Select a Biomarker",
xchoices = a$xaxis_var$choices,
xselected = a$xaxis_var$selected,
ychoices = a$yaxis_var$choices,
yselected = a$yaxis_var$selected
),
uiOutput(ns("asdf")),
teal.widgets::optionalSelectInput(
ns("facet_var"),
label = "Facet by",
Expand Down Expand Up @@ -324,13 +316,38 @@ srv_g_boxplot <- function(id,
plot_height,
plot_width,
hline_vars_colors,
hline_vars_labels) {
hline_vars_labels,
module_args) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
checkmate::assert_class(data, "reactive")
checkmate::assert_class(shiny::isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
output$asdf <- renderUI({
resolved_x <- teal.transform::resolve_delayed(
module_args$xaxis_var,
as.list(data()@env)
)
resolved_y <- teal.transform::resolve_delayed(
module_args$yaxis_var,
as.list(data()@env)
)
resolved_param <- teal.transform::resolve_delayed(
module_args$param,
as.list(data()@env)
)
vedhav marked this conversation as resolved.
Show resolved Hide resolved
templ_ui_params_vars(
session$ns,
xparam_choices = resolved_param$choices,
xparam_selected = resolved_param$selected,
xparam_label = module_args$"Select a Biomarker",
xchoices = resolved_x$choices,
xselected = resolved_x$selected,
ychoices = resolved_y$choices,
yselected = resolved_y$selected
)
})
# reused in all modules
anl_q_output <- constr_anl_q(
session, input, data, dataname,
Expand Down
Loading