Skip to content

Commit

Permalink
Revert "Merge pull request #112 from surveydown-dev/pingfan-ui-design"
Browse files Browse the repository at this point in the history
This reverts commit de911f7, reversing
changes made to f23cec1.
  • Loading branch information
pingfan-hu committed Oct 6, 2024
1 parent de911f7 commit 0fcf77d
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 ----
Expand Down Expand Up @@ -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)
})

Expand Down

0 comments on commit 0fcf77d

Please sign in to comment.