Skip to content

Commit

Permalink
reverting breaking changes and supporting teal_data
Browse files Browse the repository at this point in the history
  • Loading branch information
gogonzo committed Oct 5, 2023
1 parent 5c17ccf commit 4051ded
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 0 additions & 1 deletion R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 16 additions & 2 deletions R/module_teal_with_splash.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
Expand Down

0 comments on commit 4051ded

Please sign in to comment.