Closed averissimo closed 1 year ago
I created a POC on branch 324_disable-empty-select-encoding@main
Thanks @averissimo , can you make a PR for this since you have the POC branch already? thanks
Created here
@danielinteractive there's a possible simplification that doesn't need any custom message, but adds a dependency to the package.
Please keep that in mind when reviewing the PR
Feature description
The select inputs from
assaySpec
would improve from being disabled with a placeholder when they have no choices.For example on the Barplot (or KM module) of the RNA-Seq app app it has a weird behaviour when trying click on the dropdown (see below).
There are some options to implement this
shinyjs::disable/enable
when there are no choicesshinyWidgets::virtualSelectInput
(already a dependency) that has adisabled
parameterProof of concept
Click to expand possible patch
```R diff --git a/R/assaySpec.R b/R/assaySpec.R index 55d4c7a..f36efdf 100644 --- a/R/assaySpec.R +++ b/R/assaySpec.R @@ -19,7 +19,7 @@ assaySpecInput <- function(inputId, # nolint selectInput( inputId = ns("name"), label = label_assays, - choices = "" + choices = character(0) ) } @@ -119,6 +119,9 @@ assaySpecServer <- function(id, # nolint hermes::h_short_list(removed_assays), "as per app specifications" )) } + if (length(remaining_assays) == 0) { + remaining_assays <- list("No assays available" = "") + } remaining_assays }) @@ -129,12 +132,17 @@ assaySpecServer <- function(id, # nolint "name", choices = choices ) + if (length(choices) > 0 && choices[[1]] != "") { + shinyjs::enable("name") + } else { + shinyjs::disable("name") + } }) reactive({ choices <- choices() validate(need( - length(choices) > 0, + length(choices) > 0 && choices[[1]] != "", "No assays eligible for this experiment, please make sure to add normalized assays" )) input$name ```Screencast of issue
Screencast from 2023-08-04 12-54-03.webm