-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
898 save app state version 3 #207
base: main
Are you sure you want to change the base?
Conversation
Code Coverage Summary
Diff against main
Results for commit: 6d150fd Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 24 suites 6s ⏱️ Results for commit 6d150fd. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there. Please change filter variable in the encoding panel and see what happens - filter value is not restored properly
pkgload::load_all("teal.modules.general")
pkgload::load_all("teal.transform")
pkgload::load_all("teal")
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- rADSL
})
datanames(data) <- "ADSL"
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
app <- init(
data = data,
modules = modules(
tm_g_association(
ref = data_extract_spec(
dataname = "ADSL",
filter = filter_spec(vars = choices_selected(variable_choices("ADSL"), "SEX")),
select = select_spec(
label = "Select variable:",
choices = variable_choices(
data[["ADSL"]],
c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
),
selected = "RACE",
fixed = FALSE
)
),
vars = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variables:",
choices = variable_choices(
data[["ADSL"]],
c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
),
selected = "BMRKR2",
multiple = TRUE,
fixed = FALSE
)
),
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by Association Module")
)
)
)
)
shinyApp(app$ui, app$server)
…ring/teal.transform into 898_save_app_state3@main
Part of the PR #207 Triggering the reactivity using `observeEvent` Example to test: ```r pkgload::load_all("../teal.modules.general") pkgload::load_all("../teal.transform") pkgload::load_all("../teal") pkgload::load_all("../teal.widgets") data <- teal_data() data <- within(data, { require(nestcolor) ADSL <- rADSL ADSL$SEX2 <- rADSL$SEX }) datanames(data) <- "ADSL" join_keys(data) <- default_cdisc_join_keys[datanames(data)] app <- init( data = data, modules = modules( tm_g_association( ref = data_extract_spec( dataname = "ADSL", filter = filter_spec(vars = choices_selected(variable_choices("ADSL"), "SEX")), select = select_spec( label = "Select variable:", choices = variable_choices( data[["ADSL"]], c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2") ), selected = "RACE", fixed = FALSE ) ), vars = data_extract_spec( dataname = "ADSL", select = select_spec( label = "Select variables:", choices = variable_choices( data[["ADSL"]], c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2") ), selected = "BMRKR2", multiple = TRUE, fixed = FALSE ) ), ggplot2_args = ggplot2_args( labs = list(subtitle = "Plot generated by Association Module") ) ) ) ) shinyApp(app$ui, app$server) ```
inputId = ns("vals"), | ||
label = filter$label, | ||
choices = vals_options()$choices, | ||
selected = vals_options()$selected, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to rerender when selecting vals
selected = vals_options()$selected, | |
selected = isolate(vals_options()$selected), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no point in isolating here for two reasons:
- This isolate does not isolate, because the reactivity is triggered by
vals_options()
which is used in the line abovevals_options()$choices
- The
vals_options()
is only dependent oninput$col
and we want the input ofvals
to render on changes made toinput$col
.
Co-authored-by: Dawid Kałędkowski <[email protected]> Signed-off-by: Aleksander Chlebowski <[email protected]>
Companion to insightsengineering/teal#1011
Replaces uses of
update*Input
with server-side input creation withrenderUI
.