Skip to content

Commit c8f488a

Browse files
committed
WIP on use_evaluate
1 parent 38eb4a5 commit c8f488a

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

R/tm_g_bivariate.R

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,16 +553,17 @@ srv_g_bivariate <- function(id,
553553
selector_list = selector_list,
554554
datasets = data
555555
)
556-
qenv <- reactive({
557-
obj <- data()
558-
teal.reporter::teal_card(obj) <- append(teal.reporter::teal_card(obj), "# Bivariate Plot", after = 0)
559-
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("teal.modules.general")') # nolint quotes
560-
})
561556

562557
anl_merged_q <- reactive({
563-
req(anl_merged_input())
564-
qenv() %>%
565-
teal.code::eval_code(as.expression(anl_merged_input()$expr))
558+
obj <- data()
559+
teal.reporter::teal_card(obj) <- append(teal.reporter::teal_card(obj), "# Bivariate Plot", after = 0)
560+
obj |>
561+
teal.code::eval_code(
562+
c(
563+
expression(library(ggplot2), library(dplyr), library(teal.modules.general)),
564+
as.expression(anl_merged_input()$expr)
565+
)
566+
)
566567
})
567568

568569
merged <- list(

R/utils.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,14 @@ srv_decorate_teal_data <- function(id, data, decorators, expr) {
306306
moduleServer(id, function(input, output, session) {
307307
decorated_output <- srv_transform_teal_data("inner", data = data, transformators = decorators)
308308

309+
expr_r <- if (is.reactive(expr)) expr else reactive(expr)
310+
309311
reactive({
310312
req(decorated_output())
311313
if (no_expr) {
312314
decorated_output()
313315
} else {
314-
teal.code::eval_code(decorated_output(), expr)
316+
teal.code::eval_code(decorated_output(), expr_r())
315317
}
316318
})
317319
})

0 commit comments

Comments
 (0)