Skip to content

Commit

Permalink
prevent tbl from updating every time tab is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
bzkrouse committed Mar 28, 2024
1 parent c84cb4f commit a2a8370
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions R/mod_export.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,17 @@ export_server <- function(id, data, tfrmt_app_out, mode, cur_tab){

# trigger the table
tbl_auto_refresh <- reactiveVal(0)
tbl_needs_refresh<- reactiveVal(FALSE)

# when the final tfrmt is changed, indicate refresh is needed
observeEvent(tfrmt_app_out(), {
tbl_needs_refresh(TRUE)
})
observeEvent(cur_tab()==TRUE, {
req(tfrmt_app_out())
tbl_auto_refresh(tbl_auto_refresh()+1)
if (tbl_needs_refresh()){
tbl_auto_refresh(tbl_auto_refresh()+1)
tbl_needs_refresh(FALSE)
}
})

tbl_out <- table_inner_server("tbl_view", data, tfrmt_app_out, mode, tbl_auto_refresh)
Expand Down

0 comments on commit a2a8370

Please sign in to comment.