ObserveEvent in shiny 1.7.1

Hello,

I recently upgraded my shiny library from 1.5 to 1.7 and it looks like it caused errors with some of my observeEvents. Here is some sample code that works in 1.5 but not in 1.7. The error occurs at the event handler evaluation (Error in eval_tidy: no function to return from, jumping to top level).

library(shiny)

ui <- fluidPage(
numericInput("x", "x", 0),
textInput("y", "y")
)

server <- function(input, output, session){
observeEvent({
if ((input$x > 3) && isTruthy(input$y)) TRUE
else return()
},{
print(sprintf(
"'x' is greater than 3 and is 'y' is truthy (x = %s; y = '%s')",
input$x, input$y
))
})
}

shinyApp(ui, server)

You have written something with the form of an observe where everything in the curly braces that is reactive is registered, rather than an observeEvent which should have as its first parameter ,some reactive dependency that it listens to , then a comma , and curly braced body of the things to do that arent registered to listen to.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.