You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Snapshot function errors when the output itself is error #1685
Plotly uses snapshotPreprocessOutput to remove any output values that are randomly generated. This is great.
However, if the render function outputs an error, the result is not a valid JSON. Because of this, the snapshotPreprocessOutput function errors out and frameworks like shinytest error out as well.
Example code:
library(plotly)
ui <- fluidPage(
checkboxInput("go", label="Render plot"),
plotlyOutput("plot")
)
server <- function(input, output, session) {
output$plot_plotly <- renderPlotly({
shiny::req(input$go) #induce a silent.error if input$go is FALSE
ggplot(data.frame(x=rnorm(1000))) +
geom_histogram(aes(x=x))
})
}
shinyApp(ui=ui, server=server)
If you don't mind, it'd be great if you could try again with the development version of plotly -- remotes::install_github("ropensci/plotly") and the CRAN version of shinytest install.packages("shinytest"). If you still are encountering an error, please include devtools::session_info() and app$getDebugLog()
S/I 09:16:08.00 window.shinytest loaded
S/I 09:16:08.00 already connected
S/I 09:16:08.00 ready
S/I 09:16:08.00 idle
C/E ----------- Running application in test mode.
C/E ----------- Le chargement a nécessité le package : shiny
C/E ----------- Le chargement a nécessité le package : ggplot2
C/E -----------
C/E ----------- Attachement du package : 'plotly'
C/E -----------
C/E ----------- The following object is masked from 'package:ggplot2':
C/E -----------
C/E ----------- last_plot
C/E -----------
C/E ----------- The following object is masked from 'package:stats':
C/E -----------
C/E ----------- filter
C/E -----------
C/E ----------- The following object is masked from 'package:graphics':
C/E -----------
C/E ----------- layout
C/E -----------
C/E -----------
C/E ----------- Listening on http://127.0.0.1:4538
C/E ----------- Warning in is.na(x) :
C/E ----------- is.na() appliqué à un objet de type 'closure' qui n'est ni une liste, ni un vecteur
C/E ----------- Warning: Error in : lexical error: invalid char in json text.
C/E ----------- NULL c("shiny.silent.error", "v
C/E ----------- (right here) ------^
C/E -----------
C/E ----------- [No stack trace available]
Activity
cpsievert commentedon Feb 6, 2020
Hmm, strange, when I run your example I don't see an error:
If you don't mind, it'd be great if you could try again with the development version of plotly --
remotes::install_github("ropensci/plotly")and the CRAN version of shinytestinstall.packages("shinytest"). If you still are encountering an error, please includedevtools::session_info()andapp$getDebugLog()nouvrita commentedon Feb 13, 2020
There is an error in the example code. Instead of
plotlyOutput("plot"):plotlyOutput("plot_plotly").With this modification, I get also the error.
Here is my devtools::session_info() :
And my app$getDebugLog() :