Thanks for this really nice package @JohnCoene! Simple, yet powerful & effective.
The below app example behaves as expected if cleave() is commented out in the server function, but with cleave() included, the error "state" A regrettable decision is never revealed in the #thing output, and instead only the other 2 output "states" Required input is required 😂 and Good choice are realisable, or both are visible at the same time (when the error state is to be expected).
Is it possible to get cleave() & validate(need(...)) to work together?
library(shiny)
library(sever)
ui <- fluidPage(
use_sever(),
fluidRow(
selectInput("required_input", "Required input",
choices = c("Red pill", "Blue pill"),
multiple = TRUE
),
uiOutput("thing")
)
)
server <- function(input, output){
cleave()
# will generate errors
output$thing <- renderUI({
validate(need(input$required_input, "Required input is required 😂"))
if("Red pill" %in% input$required_input) {
h1("Good choice!")
} else {
stop("A regrettable decision.")
}
})
}
shinyApp(ui, server)
Shiny applications not supported in static R Markdown documents
Created on 2020-07-23 by the reprex package (v0.3.0)
Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.0.2 (2020-06-22)
#> os macOS Mojave 10.14.6
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Africa/Johannesburg
#> date 2020-07-23
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
#> backports 1.1.8 2020-06-17 [1] CRAN (R 4.0.2)
#> callr 3.4.3 2020-03-28 [1] CRAN (R 4.0.1)
#> cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.1)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2)
#> desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.1)
#> devtools 2.3.1.9000 2020-07-22 [1] Github (r-lib/devtools@1dca68b)
#> digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.2)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.1)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2)
#> fastmap 1.0.1 2019-10-08 [1] CRAN (R 4.0.2)
#> fs 1.4.2 2020-06-30 [1] CRAN (R 4.0.2)
#> glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.2)
#> highr 0.8 2019-03-20 [1] CRAN (R 4.0.2)
#> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.1)
#> httpuv 1.5.4 2020-06-06 [1] CRAN (R 4.0.1)
#> knitr 1.29 2020-06-23 [1] CRAN (R 4.0.1)
#> later 1.1.0.1 2020-06-05 [1] CRAN (R 4.0.1)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.2)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.2)
#> mime 0.9 2020-02-04 [1] CRAN (R 4.0.2)
#> pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.2)
#> pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.1)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
#> processx 3.4.3 2020-07-05 [1] CRAN (R 4.0.1)
#> promises 1.1.1 2020-06-09 [1] CRAN (R 4.0.1)
#> ps 1.3.3 2020-05-08 [1] CRAN (R 4.0.2)
#> R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.2)
#> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
#> remotes 2.2.0 2020-07-21 [1] CRAN (R 4.0.2)
#> rlang 0.4.7 2020-07-09 [1] CRAN (R 4.0.2)
#> rmarkdown 2.3 2020-06-18 [1] CRAN (R 4.0.1)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.1)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.1)
#> sever * 0.0.5.9000 2020-07-23 [1] Github (JohnCoene/sever@859dfc8)
#> shiny * 1.5.0 2020-06-23 [1] CRAN (R 4.0.1)
#> stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.2)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.1)
#> testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.1)
#> usethis 1.6.1 2020-04-29 [1] CRAN (R 4.0.1)
#> withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.2)
#> xfun 0.15 2020-06-21 [1] CRAN (R 4.0.2)
#> xtable 1.8-4 2019-04-21 [1] CRAN (R 4.0.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.2)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
Thanks for this really nice package @JohnCoene! Simple, yet powerful & effective.
The below app example behaves as expected if
cleave()is commented out in the server function, but withcleave()included, the error "state"A regrettable decisionis never revealed in the #thing output, and instead only the other 2 output "states"Required input is required 😂andGood choiceare realisable, or both are visible at the same time (when the error state is to be expected).Is it possible to get
cleave()&validate(need(...))to work together?Shiny applications not supported in static R Markdown documents
Created on 2020-07-23 by the reprex package (v0.3.0)
Session info