Skip to content

Commit

Permalink
The default matches before this PR
Browse files Browse the repository at this point in the history
  • Loading branch information
llrs-roche committed Jan 10, 2025
1 parent d79fee8 commit 60f9544
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
#' @export
#'
tm_variable_browser <- function(label = "Variable Browser",
datasets_selected = "all",
datanames = datasets_selected,
datasets_selected = character(0),
datanames = if (length(datasets_selected) == 0) "all" else datasets_selected,
parent_dataname = "ADSL",
pre_output = NULL,
post_output = NULL,
Expand All @@ -102,11 +102,14 @@ tm_variable_browser <- function(label = "Variable Browser",

# Start of assertions
checkmate::assert_string(label)
if (!is.null(datasets_selected)) {
if (!missing(datasets_selected)) {
lifecycle::deprecate_soft(
when = "0.4.0",
what = "tm_variable_browser(datasets_selected",
with = "tm_variable_browser(datanames)"
what = "tm_variable_browser(datasets_selected)",
with = "tm_variable_browser(datanames)",
details = c(
"If both `datasets_selected` and `datanames` are set `datasets_selected` will be silently ignored.",
i = 'Use `tm_variable_browser(datanames = "all")` to keep the previous behavior and avoid this warning.')
)
}
checkmate::assert_character(datanames, min.len = 0, min.chars = 1, null.ok = TRUE)
Expand All @@ -121,7 +124,7 @@ tm_variable_browser <- function(label = "Variable Browser",
label,
server = srv_variable_browser,
ui = ui_variable_browser,
datanames = datanames,
datanames = union(datanames, parent_dataname),
server_args = list(
datanames = datanames,
parent_dataname = parent_dataname,
Expand Down Expand Up @@ -235,12 +238,6 @@ srv_variable_browser <- function(id,
is.data.frame(isolate(data())[[name]])
}, datanames)

checkmate::assert_character(datanames)
checkmate::assert_subset(datanames, datanames)
if (!identical(datanames, character(0))) {
checkmate::assert_subset(datanames, datanames)
}

output$ui_variable_browser <- renderUI({
ns <- session$ns
do.call(
Expand Down

0 comments on commit 60f9544

Please sign in to comment.