From 4051dedb92639f06dfb3ce7e8479fd44324caf70 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Thu, 5 Oct 2023 15:49:33 +0200 Subject: [PATCH] reverting breaking changes and supporting teal_data --- R/init.R | 1 - R/module_teal_with_splash.R | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/R/init.R b/R/init.R index d76a9ef750..ee7ec5ebfe 100644 --- a/R/init.R +++ b/R/init.R @@ -114,7 +114,6 @@ init <- function(data, footer = tags$p(), id = character(0)) { logger::log_trace("init initializing teal app with: data ({ class(data)[1] }).") - data <- teal.data::to_relational_data(data = data) if (!inherits(data, c("TealData", "teal_data"))) { data <- teal.data::to_relational_data(data = data) diff --git a/R/module_teal_with_splash.R b/R/module_teal_with_splash.R index 910c346fcb..dc91b88a51 100644 --- a/R/module_teal_with_splash.R +++ b/R/module_teal_with_splash.R @@ -71,9 +71,23 @@ srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) { raw_data <- if (inherits(data, "teal_data")) { reactiveVal(data) } else if (teal.data::is_pulled(data)) { - reactiveVal(data) # will trigger by setting it + new_data <- new_teal_data( + env = lapply(data$get_datasets(), function(x) x$get_raw_data()), + code = data$get_code(), + keys = data$get_join_keys() + ) + reactiveVal(new_data) # will trigger by setting it } else { - raw_data <- data$get_server()(id = "startapp_module") + raw_data_old <- data$get_server()(id = "startapp_module") + raw_data <- reactive({ + data <- raw_data_old() + new_teal_data( + env = lapply(data$get_datasets(), function(x) x$get_raw_data()), + code = data$get_code(), + keys = data$get_join_keys() + ) + }) + if (!is.reactive(raw_data)) { stop("The delayed loading module has to return a reactive object.") }