Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Content in panel_group is not bookmarkable #238

Open
3 tasks done
Tracked by #1011
gogonzo opened this issue Mar 27, 2024 · 0 comments
Open
3 tasks done
Tracked by #1011

[Bug]: Content in panel_group is not bookmarkable #238

gogonzo opened this issue Mar 27, 2024 · 0 comments

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Mar 27, 2024

What happened?

Inputs enclosed in teal.widgets::panel_group are not shiny-bookmarkable. This was found out in teal.modules.general where all inputs are restored except those in teal.widgets::panel_group.

app code
  • set some random inputs
  • bookmark
  • restore bookmark and see that plot-settings are not restored from encoding panel
options(teal.log_level = "TRACE", teal.show_js_log = TRUE)
library(shiny)
library(teal.widgets)
library(teal.transform)
pkgload::load_all("teal.modules.general")

data <- within(teal_data(), {
  require(nestcolor)
  IRIS <- iris
  MTCARS <- mtcars
  USArrests <- USArrests
  ADSL <- rADSL
  ADTTE <- rADTTE
  ADRS <- rADRS
})
datanames(data) <- c("IRIS", "MTCARS", "USArrests", "ADSL", "ADTTE", "ADRS")
join_keys(data) <- default_cdisc_join_keys[datanames(data)]

shiny_app <- function(module) {
  ui <- function(request) {
    fluidPage(
      bookmarkButton(),
      do.call(module$ui, c(list(id = "teal_module"), module$ui_args))
    )
  }

  server <- function(input, output, session) {
    data_list <-
      args <- c(
        list(id = "teal_module"),
        if ("data" %in% names(formals(module$server))) {
          list(data = reactive(data))
        },
        module$server_args
      )
    do.call(module$server, args)
  }

  shinyApp(ui, server, enableBookmarking = "server")
}


shiny_app(
  tm_g_bivariate(
    x = data_extract_spec(
      dataname = "ADSL",
      select = select_spec(
        label = "Select variable:",
        choices = variable_choices(data[["ADSL"]]),
        selected = "AGE",
        fixed = FALSE
      )
    ),
    y = data_extract_spec(
      dataname = "ADSL",
      select = select_spec(
        label = "Select variable:",
        choices = variable_choices(data[["ADSL"]]),
        selected = "SEX",
        multiple = FALSE,
        fixed = FALSE
      )
    ),
    row_facet = data_extract_spec(
      dataname = "ADSL",
      select = select_spec(
        label = "Select variable:",
        choices = variable_choices(data[["ADSL"]]),
        selected = "ARM",
        fixed = FALSE
      )
    ),
    col_facet = data_extract_spec(
      dataname = "ADSL",
      select = select_spec(
        label = "Select variable:",
        choices = variable_choices(data[["ADSL"]]),
        selected = "COUNTRY",
        fixed = FALSE
      )
    ),
    ggplot2_args = ggplot2_args(
      labs = list(subtitle = "Plot generated by Bivariate Module")
    )
  )
)

sessionInfo()

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants