From 0fcf77d819ac469288360ce402b351a13f9f2434 Mon Sep 17 00:00:00 2001 From: Pingfan Hu Date: Sun, 6 Oct 2024 17:56:38 -0400 Subject: [PATCH] Revert "Merge pull request #112 from surveydown-dev/pingfan-ui-design" This reverts commit de911f709672d15acaf8d103195c198dc5df7a1c, reversing changes made to f23cec1cb113f2a3a1156b2e4c43860fe8f9d5c9. --- R/server.R | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/R/server.R b/R/server.R index df387240..d1cfa9dd 100644 --- a/R/server.R +++ b/R/server.R @@ -149,17 +149,13 @@ sd_server <- function( setNames(rep(TRUE, length(question_ids)), question_ids) ) - # Check for interaction - interaction_occurred <- shiny::reactiveVal(FALSE) - shiny::observeEvent(show_if_results(), { - interaction_occurred(TRUE) - }) - - # Observer for show/hide logic + # Create a new observer for show/hide logic shiny::observe({ # This will re-run whenever the page changes or is re-rendered current_page_id() - shiny::req(interaction_occurred()) + + # Add a small delay to ensure DOM is updated + shiny::invalidateLater(50) results <- show_if_results() current_visibility <- question_visibility() @@ -172,10 +168,8 @@ sd_server <- function( shinyjs::hide(paste0('container-', target)) } } - question_visibility(current_visibility) - # Reset the interaction flag - interaction_occurred(FALSE) + question_visibility(current_visibility) }) # Initialize local functions ---- @@ -305,9 +299,6 @@ sd_server <- function( # Update data after a short delay shiny::invalidateLater(100) - - # Trigger the show/hide logic - interaction_occurred(TRUE) }, ignoreNULL = FALSE, ignoreInit = TRUE) })