Skip to content

Commit

Permalink
refine behavior of mock mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bzkrouse committed Aug 2, 2024
1 parent baa1573 commit 46aede7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions R/mod_datamapping.R
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ datamapping_server <- function(id, data, tfrmt_orig, mode){
observeEvent(input$save,{
save_counter(save_counter()+1)
})
observeEvent(mode(),{
if (initial_valid()==TRUE){
save_counter(save_counter()+1)
}
})

settings_out <- eventReactive(req(save_counter()>0),{

Expand Down Expand Up @@ -251,6 +256,7 @@ datamapping_server <- function(id, data, tfrmt_orig, mode){
original= initial_valid()
)
})

return(settings_out)

})
Expand Down
6 changes: 3 additions & 3 deletions R/mod_load.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ load_server <- function(id, tfrmt_in = reactive(NULL), data_in = reactive(NULL),
# keep track of mode for downstream functionality
mode <- reactive({
if (mockmode() == TRUE){
if (input$data_source=="Auto"){
"mock_no_data"
} else {
if (!is.null(data_in()) || !input$data_source=="Auto"){
"mock_with_data"
} else {
"mock_no_data"
}
} else if (mockmode() == FALSE){
"reporting"
Expand Down
6 changes: 3 additions & 3 deletions R/mod_table_outer.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ table_outer_ui <- function(id){
#' @param subtab Name of selected tab in the Edit pane tabPanel
#' @param data data for the table
#' @param tfrmt_app_out final tfrmt for the table
#' @param settings mock mode w/ no data, w/ data, reporting
#' @param mode mock mode w/ no data, w/ data, reporting
#'
#' @noRd
table_outer_server <- function(id, cur_tab, subtab, data, tfrmt_app_out, settings){
table_outer_server <- function(id, cur_tab, subtab, data, tfrmt_app_out, mode){

moduleServer(
id,
Expand Down Expand Up @@ -78,7 +78,7 @@ table_outer_server <- function(id, cur_tab, subtab, data, tfrmt_app_out, setting
tbl_needs_refresh(FALSE)
})

table_inner_server("tbl", data, tfrmt_app_out, reactive(settings()$mode), tbl_auto_refresh)
table_inner_server("tbl", data, tfrmt_app_out, mode, tbl_auto_refresh)

}
)
Expand Down
2 changes: 1 addition & 1 deletion R/tfrmtbuilder_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ tfrmtbuilder_server <- function(id, tfrmt, data) {
subtab = reactive(input$tabs),
data = reactive(settings()$data) ,
tfrmt_app_out = tfrmt_app_out,
settings = settings
mode = reactive(settings()$mode)
)

# export module
Expand Down

0 comments on commit 46aede7

Please sign in to comment.