Skip to content

Commit

Permalink
- deprecating id argument in init
Browse files Browse the repository at this point in the history
- fixing (wrong) id documentation in inherited docs
- fixing docs inheritance
  • Loading branch information
gogonzo committed Jan 13, 2025
1 parent e07fc33 commit 96cce5a
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 40 deletions.
23 changes: 19 additions & 4 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
#' the header of the app.
#' @param footer (`shiny.tag` or `character(1)`) Optionally,
#' the footer of the app.
#' @param id (`character`) Optionally,
#' @param id `r lifecycle::badge("deprecated")` (`character`) Optionally,
#' a string specifying the `shiny` module id in cases it is used as a `shiny` module
#' rather than a standalone `shiny` app. This is a legacy feature.
#' rather than a standalone `shiny` app. This is a legacy feature. Deprecated since v0.15.3
#' please use [ui_teal()] and [srv_teal()] instead.
#'
#' @param landing_popup (`teal_module_landing`) Optionally,
#' a `landing_popup_module` to show up as soon as the teal app is initialized.
#'
Expand Down Expand Up @@ -96,7 +98,7 @@ init <- function(data,
title = build_app_title(),
header = tags$p(),
footer = tags$p(),
id = character(0),
id = lifecycle::deprecated(),
landing_popup = NULL) {
logger::log_debug("init initializing teal app with: data ('{ class(data) }').")

Expand Down Expand Up @@ -137,7 +139,6 @@ init <- function(data,
checkmate::check_string(footer),
checkmate::check_multi_class(footer, c("shiny.tag", "shiny.tag.list", "html"))
)
checkmate::assert_character(id, max.len = 1, any.missing = FALSE)

# log
teal.logger::log_system_info()
Expand Down Expand Up @@ -221,6 +222,20 @@ init <- function(data,
)
}


if (lifecycle::is_present(id)) {
lifecycle::deprecate_soft(
when = "0.15.3",
what = "init(id)",
details = paste(
"To wrap `teal` application within other shiny application please use",
"`ui_teal()` and `srv_teal()` and call them as normal shiny modules"
)
)
checkmate::assert_character(id, max.len = 1, any.missing = FALSE)
} else {
id <- character(0)
}
ns <- NS(id)
# Note: UI must be a function to support bookmarking.
res <- list(
Expand Down
2 changes: 1 addition & 1 deletion R/module_bookmark_manager.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' - set `options(shiny.bookmarkStore = "server")` before running the app
#'
#'
#' @inheritParams init
#' @inheritParams module_teal
#'
#' @return Invisible `NULL`.
#'
Expand Down
3 changes: 1 addition & 2 deletions R/module_data_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#' Module includes also "Show/Hide unsupported" button to toggle rows of the summary table
#' containing datasets where number of observations are not calculated.
#'
#' @param id (`character(1)`) `shiny` module instance id.
#' @param teal_data (`reactive` returning `teal_data`)
#' @inheritParams module_teal_module
#'
#' @name module_data_summary
#' @rdname module_data_summary
Expand Down
5 changes: 1 addition & 4 deletions R/module_init_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
#'
#' For more details, see [`module_teal_data`].
#'
#' @inheritParams init
#'
#' @param data (`teal_data`, `teal_data_module`, or `reactive` returning `teal_data`)
#' The data which application will depend on.
#' @inheritParams module_teal
#'
#' @return A `reactive` object that returns:
#' Output of the `data`. If `data` fails then returned error is handled (after [tryCatch()]) so that
Expand Down
4 changes: 3 additions & 1 deletion R/module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#' @rdname module_teal
#' @name module_teal
#'
#' @inheritParams module_init_data
#' @inheritParams init
#' @param id (`character(1)`) `shiny` module instance id.
#' @param data (`teal_data`, `teal_data_module`, or `reactive` returning `teal_data`)
#' The data which application will depend on.
#'
#' @return `NULL` invisibly
NULL
Expand Down
3 changes: 1 addition & 2 deletions R/module_teal_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#' resolved, the app will continue to run. `teal` guarantees that errors in data don't crash the app
#' (except error 1).
#'
#' @param id (`character(1)`) Module id
#' @param data (`reactive teal_data`)
#' @inheritParams module_teal_module
#' @param data_module (`teal_data_module`)
#' @param modules (`teal_modules` or `teal_module`) For `datanames` validation purpose
#' @param validate_shiny_silent_error (`logical`) If `TRUE`, then `shiny.silent.error` is validated and
Expand Down
1 change: 1 addition & 0 deletions R/module_teal_lockfile.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' Generate lockfile for application's environment reproducibility
#'
#' @inheritParams module_teal
#' @param lockfile_path (`character`) path to the lockfile.
#'
#' @section Different ways of creating lockfile:
Expand Down
7 changes: 4 additions & 3 deletions man/init.Rd

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

4 changes: 1 addition & 3 deletions man/module_bookmark_manager.Rd

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

2 changes: 1 addition & 1 deletion man/module_data_summary.Rd

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

4 changes: 1 addition & 3 deletions man/module_filter_data.Rd

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

4 changes: 1 addition & 3 deletions man/module_init_data.Rd

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

4 changes: 1 addition & 3 deletions man/module_teal.Rd

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

4 changes: 2 additions & 2 deletions man/module_teal_data.Rd

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

2 changes: 2 additions & 0 deletions man/module_teal_lockfile.Rd

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

4 changes: 1 addition & 3 deletions man/module_teal_module.Rd

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

4 changes: 1 addition & 3 deletions man/module_teal_with_splash.Rd

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

4 changes: 2 additions & 2 deletions man/module_transform_data.Rd

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

0 comments on commit 96cce5a

Please sign in to comment.