Skip to content

Commit 4420127

Browse files
committed
feat: initial copy of support functions
1 parent 9d193d3 commit 4420127

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

R/utils.R

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,21 +299,26 @@ srv_decorate_teal_data <- function(id, data, decorators, expr, expr_is_reactive
299299

300300
missing_expr <- missing(expr)
301301
if (!missing_expr && !expr_is_reactive) {
302-
expr <- rlang::enexpr(expr)
302+
expr <- dplyr::enexpr(expr) # Using dplyr re-export to avoid adding rlang to Imports
303303
}
304304

305305
moduleServer(id, function(input, output, session) {
306306
decorated_output <- srv_transform_teal_data("inner", data = data, transformators = decorators)
307307

308308
reactive({
309-
# ensure original errors are displayed and `eval_code` is never executed with NULL
310-
req(data(), decorated_output())
311-
if (missing_expr) {
312-
decorated_output()
313-
} else if (expr_is_reactive) {
314-
teal.code::eval_code(decorated_output(), expr())
309+
data_out <- try(data(), silent = TRUE)
310+
if (inherits(data_out, "qenv.error")) {
311+
data()
315312
} else {
316-
teal.code::eval_code(decorated_output(), expr)
313+
# ensure original errors are displayed and `eval_code` is never executed with NULL
314+
req(data(), decorated_output())
315+
if (missing_expr) {
316+
decorated_output()
317+
} else if (expr_is_reactive) {
318+
teal.code::eval_code(decorated_output(), expr())
319+
} else {
320+
teal.code::eval_code(decorated_output(), expr)
321+
}
317322
}
318323
})
319324
})
@@ -394,7 +399,7 @@ select_decorators <- function(decorators, scope) {
394399

395400
#' Convert flat list of `teal_transform_module` to named lists
396401
#'
397-
#' @param decorators (list of `teal_transform_module`) to normalize.
402+
#' @param decorators (list of `teal_transform_modules`) to normalize.
398403
#' @return A named list of lists with `teal_transform_module` objects.
399404
#' @keywords internal
400405
normalize_decorators <- function(decorators) {

0 commit comments

Comments
 (0)