Skip to content

Commit e90b44e

Browse files
committed
add req statement so that when srv_teal_transform_data returns NULL you see error from original teal_data
1 parent 9fbaf45 commit e90b44e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

R/tm_data_table.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ tm_data_table <- function(label = "Data Table",
105105
server_rendering = FALSE,
106106
pre_output = NULL,
107107
post_output = NULL,
108-
decorators = list(default = teal_transform_module())) {
108+
decorators = NULL) {
109109
message("Initializing tm_data_table")
110110

111111
# Start of assertions
@@ -131,7 +131,7 @@ tm_data_table <- function(label = "Data Table",
131131
checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
132132
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
133133

134-
checkmate::assert_list(decorators, "teal_transform_module")
134+
checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE)
135135
# End of assertions
136136

137137
ans <- module(
@@ -345,6 +345,7 @@ srv_data_table <- function(id,
345345
data(),
346346
substitute(
347347
expr = {
348+
variables <- vars
348349
dataframe_selected <- if (if_distinct) {
349350
dplyr::count(dataname, dplyr::across(dplyr::all_of(variables)))
350351
} else {
@@ -361,7 +362,7 @@ srv_data_table <- function(id,
361362
env = list(
362363
dataname = as.name(dataname),
363364
if_distinct = if_distinct(),
364-
variables = input$variables,
365+
vars = input$variables,
365366
args = dt_args,
366367
dt_options = dt_options,
367368
dt_rows = input$dt_rows
@@ -374,6 +375,7 @@ srv_data_table <- function(id,
374375
srv_teal_transform_data("decorate", data = data_table_data, transformators = decorators)
375376

376377
output$data_table <- DT::renderDataTable(server = server_rendering, {
378+
req(data_table_data())
377379
# no table is displayed
378380
decorated_data_table_data()[["table"]]
379381
})

0 commit comments

Comments
 (0)