Skip to content

Commit

Permalink
Simplify click interaction. Tweak test to pass locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-ebs-ext committed Oct 10, 2024
1 parent 247bc65 commit bf21b4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 3 additions & 11 deletions R/mod_main_view.R
Original file line number Diff line number Diff line change
Expand Up @@ -348,19 +348,11 @@ mod_main_view_server <- function(module_id, initial_data, changed,
)
})

# tell if there was a click on the main plot
clicked <- shiny::reactiveVal(FALSE)

shiny::observeEvent(input$plot_click, {
clicked(TRUE)
})


# Get unique subject identifier either from click
# Get unique subject identifier from click
subject_id <- shiny::reactive({
shiny::req(input$plot_click, clicked())
shiny::req(input$plot_click)

# Get y position of the click & find the matching subject identifier
# Get y position of the click and find the matching subject identifier
position <- round(input$plot_click$y)
subject <- input$plot_click$domain$discrete_limits$y[[position]]
subject
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-mod_clinical_timelines.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ test_that("local filters are resetted (only) after dataset switch" %>%
"rel" = app$get_value(input = "mod-filter-drug_rel_ae")
)
app$set_inputs(selector = "dummyData2")
app$wait_for_idle()
app$wait_for_idle() # cope with slow update
actual_after <- c(
"sae" = app$get_value(input = "mod-filter-serious_ae"),
"soc" = app$get_value(input = "mod-filter-soc"),
Expand Down

0 comments on commit bf21b4b

Please sign in to comment.