insightsengineering / insightsengineering/teal.widgets

[Bug]: Content in panel_group is not bookmarkable

Open
#238 0 comments 0 reactions 0 assignees View on GitHub
bug core
Dominant language
R
Stars
6
Forks
8
PR merge metrics
No merged PRs in 30d

Description

### 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

```r
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

- [X] I agree to follow this project's Code of Conduct.

### Contribution Guidelines

- [X] I agree to follow this project's Contribution Guidelines.

### Security Policy

- [X] I agree to follow this project's Security Policy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.