Hi @abelb0rges,
if you change your observeEvent
to
observeEvent(input$sent, {
txt <- expr_output(input$req)
output$res2 <- renderText(txt)
# more elegant alternative
output$res2 <- renderText(expr_output(isolate(input$req)))
})
you get the desired behaviour.
To my understanding, the crucial point is the following:
In your observeEvent
you connect an output value to a reactive input value, i.e. at the first click of the button the connection is established and then persists in the reactive dependency graph forever. In your source code, both lines with output$res1/2 <- ...
are qualitatively identical, i.e they both connect two reactives; res1
is a reactive expression while input$req$
is a reactive value.
You can break the connection by inserting a non-reactive variable or by using isolate
.
Hope that helps...