Skip to content

Commit

Permalink
only auto-refresh for completed tfrmt on initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bzkrouse committed Mar 12, 2024
1 parent 94cd1a4 commit 6089536
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions R/mod_table_outer.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@ table_outer_server <- function(id, tab_selected, data, tfrmt_app_out, settings){

auto_tbl <- reactiveVal(0)

tfrmt_counter <- reactiveVal(0)

observeEvent(tfrmt_app_out(),{
if (is.null(tfrmt_app_out())){
tfrmt_counter(0)
} else {
tfrmt_counter(tfrmt_counter()+1)
}
})
observe(print(tfrmt_counter()))
# on initialization, if all valid
observe({
req(settings()$original==TRUE)
req(tfrmt_app_out())
req(tfrmt_counter()==1)

isolate(
auto_tbl(auto_tbl()+1)
Expand Down Expand Up @@ -73,12 +83,12 @@ table_outer_server <- function(id, tab_selected, data, tfrmt_app_out, settings){
tbl_invalid<- reactiveVal(FALSE)

# when the final tfrmt is changed, indicate refresh is needed
observeEvent(c(tfrmt_app_out(), settings()), {
observeEvent(tfrmt_app_out(), {
shinyjs::addClass("refresh", class = "btn-danger")
shinyjs::removeClass("refresh", class = "btn-refresh")

tbl_invalid(TRUE)
}, priority = 100)
})
# when display update is triggered, remove the indication
observeEvent(req(auto_tbl()>0),{
shinyjs::removeClass("refresh", class = "btn-danger")
Expand Down

0 comments on commit 6089536

Please sign in to comment.