daattali / shinyalert

🗯️ Easily create pretty popup messages (modals) in Shiny
https://daattali.com/shiny/shinyalert-demo/
Other
241 stars 26 forks source link

Error with R-4.3.0 #75

Closed stla closed 1 year ago

stla commented 1 year ago

Hello,

Previously this code in the example given in the package:

shinyalert(
          html = TRUE,
          text = tagList(
            numericInput("num", "Number", 10),
            "The square of the number is",
            textOutput("square", inline = TRUE)
          )
        )

threw a warning: Warning in &&: 'length = 3' in coercion to 'logical(1)'.

Now it throws an error. Maybe the fix is to add any here:

if(html && any(nzchar(text)))
daattali commented 1 year ago

I remember fixing a similar issue recently. Is this using the github version or CRAN?

stla commented 1 year ago

CRAN version.

stla commented 1 year ago

Indeed, you already changed this code:

 if (html && !is.null(params[["text"]]) && (length(params[["text"]]) > 1 || nzchar(as.character(params[["text"]]))))
SebiJos commented 1 year ago

Hi Guys, where or how to perform this change in the code?

if (html && !is.null(params[["text"]]) && (length(params[["text"]]) > 1 || nzchar(as.character(params[["text"]])))) ==> if(html && any(nzchar(text)))

daattali commented 1 year ago

It's already been done - you need to use the github version , not the CRAN version

SebiJos commented 1 year ago

Hi Dean,

Thanks for your answer which gives me hope I can get Shiny to work again, but I have no clue on what to do exactly? Should I reinstall RStudio from the files on Github, or only replace/update somewhere the shiny package/library?

Thanks in advance!

Seb

stla commented 1 year ago

@SebiJos See ?install_github in the remotes package.

SebiJos commented 1 year ago

Hi Stla, I actually already did that, but tried again, without success:

remotes::install_github("rstudio/shiny", force = TRUE)

SebiJos commented 1 year ago

` R version 4.3.1 (2023-06-16 ucrt) -- "Beagle Scouts" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)

remotes::install_github("rstudio/shiny", force = TRUE) Downloading GitHub repo rstudio/shiny@HEAD -- R CMD build ---------------------------------------------------------------------------------------------------------------------------- v checking for file 'C:\Users\XXX\AppData\Local\Temp\RtmpW4rf5g\remotes8f2c171b35c7\rstudio-shiny-d21f949/DESCRIPTION' (487ms)

  • preparing 'shiny': (2.8s) v checking DESCRIPTION meta-information ...
  • checking for LF line-endings in source and make files and shell scripts (1.3s)
  • checking for empty or unneeded directories
  • building 'shiny_1.7.5.9000.tar.gz'

Installiere Paket nach ‘C:/Users/josset/AppData/Local/R/win-library/4.3’ (da ‘lib’ nicht spezifiziert)

Listening on http://127.0.0.1:5054 Warning: Error in &&: 'length = 3' in coercion to 'logical(1)' 49: .rs.findBreakpointSteps 48: .rs.findBreakpointSteps 47: .rs.findBreakpointSteps 46: .rs.findBreakpointSteps 45: .rs.removeBreakpoints 44: registerShinyDebugHook 43: registerDebugHook 42: wrapFunctionLabel 41: .subset2(x, "impl")$defineOutput 40: $<-.shinyoutput 38: server [C:\Users\XXX\OneDrive - Henkel\Documents\230828 R Files\my_shiny_app/app.R#38] 1: shiny::runApp Error in is.call(funBody[[idx]]) && as.character(funBody[[idx]][[1]]) == : 'length = 3' in coercion to 'logical(1)'`

stla commented 1 year ago

You want to install shinyalert, so do:

remotes::install_github("daattali/shinyalert")
daattali commented 4 months ago

A new version was submitted to CRAN today, it will be on CRAN in a few days