Skip to content

Commit

Permalink
Prevent breaking user code and simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
llrs-roche committed Jan 10, 2025
1 parent 6ba1998 commit bd44f70
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ tm_data_table <- function(label = "Data Table",
if (!is.null(datasets_selected)) {
lifecycle::deprecate_soft(
when = "0.4.0",
what = "tm_data_table(datasets_selected = 'is deprecated, use `datanames`')"
what = "tm_data_table(datasets_selected",
with = "tm_data_table(datanames)"
)
}
checkmate::assert_character(datanames, min.len = 0, min.chars = 1, null.ok = TRUE)
Expand All @@ -134,7 +135,7 @@ tm_data_table <- function(label = "Data Table",
label,
server = srv_page_data_table,
ui = ui_page_data_table,
datanames = if (length(datanames) == 0) "all" else datanames,
datanames = datanames,
server_args = list(
variables_selected = variables_selected,
datanames = datanames,
Expand Down
9 changes: 5 additions & 4 deletions R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ tm_front_page <- function(label = "Front page",
tables = list(),
additional_tags = tagList(),
footnotes = character(0),
show_metadata = NULL,
datanames = NULL) {
show_metadata = TRUE,
datanames = if(isTRUE(show_metadata)) "all" else NULL) {

Check warning on line 75 in R/tm_front_page.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_front_page.R,line=75,col=41,[spaces_left_parentheses_linter] Place a space before left parenthesis, except in a function call.
message("Initializing tm_front_page")

# Start of assertions
Expand All @@ -84,7 +84,8 @@ tm_front_page <- function(label = "Front page",
if (!is.null(show_metadata)) {
lifecycle::deprecate_soft(
when = "0.4.0",
what = "tm_front_page(show_metadata = 'is deprecated, use `datanames`')"
what = "tm_front_page(show_metadata)",
with = "tm_front_page(datanames)"
)
}
checkmate::assert_character(datanames,
Expand All @@ -103,7 +104,7 @@ tm_front_page <- function(label = "Front page",
ui = ui_front_page,
ui_args = args,
server_args = list(tables = tables),
datanames = datanames
datanames = unique(datanames)
)
attr(ans, "teal_bookmarkable") <- TRUE
ans
Expand Down
5 changes: 3 additions & 2 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ tm_variable_browser <- function(label = "Variable Browser",
if (!is.null(datasets_selected)) {
lifecycle::deprecate_soft(
when = "0.4.0",
what = "tm_variable_browser(datasets_selected = 'is deprecated, use `datanames`')"
what = "tm_variable_browser(datasets_selected",
with = "tm_variable_browser(datanames)"
)
}
checkmate::assert_character(datanames, min.len = 0, min.chars = 1, null.ok = TRUE)
Expand All @@ -121,7 +122,7 @@ tm_variable_browser <- function(label = "Variable Browser",
label,
server = srv_variable_browser,
ui = ui_variable_browser,
datanames = if (length(datanames) == 0) "all" else datanames,
datanames = datanames,
server_args = list(
datanames = datanames,
parent_dataname = parent_dataname,
Expand Down
4 changes: 2 additions & 2 deletions man/tm_front_page.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bd44f70

Please sign in to comment.