Skip to content

Commit

Permalink
remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
gogonzo committed Aug 30, 2024
1 parent f6f5a35 commit 3bf87ac
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 37 deletions.
14 changes: 3 additions & 11 deletions R/module_nested_tabs.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ srv_teal_module.teal_module <- function(id,
is_active = reactive(TRUE)) {
logger::log_debug("srv_teal_module.teal_module initializing the module: { deparse1(modules$label) }.")
moduleServer(id = id, module = function(input, output, session) {
active_datanames <- reactive({
.resolve_module_datanames(data = data_rv(), modules = modules)
})
active_datanames <- reactive(.resolve_module_datanames(data = data_rv(), modules = modules))
if (is.null(datasets)) {
datasets <- eventReactive(data_rv(), {
if (!inherits(data_rv(), "teal_data")) {
Expand Down Expand Up @@ -223,20 +221,14 @@ srv_teal_module.teal_module <- function(id,
modules = modules
)

summary_teal_data <- reactive({
all_teal_data <- transformed_teal_data()
module_datanames <- .resolve_module_datanames(data = all_teal_data, modules = modules)
.subset_teal_data(all_teal_data, module_datanames)
})

summary_table <- srv_data_summary("data_summary", summary_teal_data)

module_teal_data <- reactive({
all_teal_data <- transformed_teal_data()
module_datanames <- .resolve_module_datanames(data = all_teal_data, modules = modules)
.subset_teal_data(all_teal_data, module_datanames)
})

summary_table <- srv_data_summary("data_summary", module_teal_data)

module_teal_data_validated <- srv_validate_reactive_teal_data(
"validate_datanames",
data = module_teal_data,
Expand Down
13 changes: 0 additions & 13 deletions R/modules.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,6 @@ format.teal_modules <- function(x, indent = 0, ...) {
)
}

#' @param modules (`teal_module` or `teal_modules`)
#' @rdname teal_modules
#' @export
set_datanames <- function(modules, datanames) {
checkmate::assert_multi_class(modules, c("teal_modules", "teal_module"))
if (inherits(modules, "teal_modules")) {
modules$children <- lapply(modules$children, set_datanames, datanames)
} else {
modules$datanames <- datanames
}
modules
}

#' @rdname teal_modules
#' @export
print.teal_modules <- print.teal_module
Expand Down
8 changes: 4 additions & 4 deletions R/teal_data_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ teal_data_module <- function(ui, server, label = "data module", once = TRUE) {
#' where the `id` is the module id and `data` is the reactive `teal_data` input.
#' The server function must return reactive expression containing `teal_data` object.
#' @param datanames (`character`)
#' Determines names of the filtered datasets required for the `teal_transform_module` to work. Specified
#' `datanames` will be displayed in the filter panel. If not specified, `teal_transform_module` will receive
#' filtered datasets specified in [module()] `datanames` and every other object will remain unfiltered and hidden in
#' a filter panel.
#' Names of the datasets that are relevant for the item. The filter panel will only display filters
#' for specified `datanames`. The keyword `"all"` will show filters of all datasets. `datanames`
#' will be automatically appended to the [modules()] `datanames`.
#' @examples
#' my_transformers <- list(
#' teal_transform_module(
#' label = "Custom transform for iris",
#' datanames = "iris",
#' ui = function(id) {
#' ns <- NS(id)
#' tags$div(
Expand Down
5 changes: 0 additions & 5 deletions man/teal_modules.Rd

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

8 changes: 4 additions & 4 deletions man/teal_transform_module.Rd

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

0 comments on commit 3bf87ac

Please sign in to comment.