I have a small and frustrating problem in my large app. This reactive text does not render when user$stationtype or user$stationvar change (both are elements of user <- reactiveValues()) but does render when stationname() changes (stationname <- reactiveVal()). The ui side is textOutput("timeheader").
output$timeheader <- renderText({
# FIXME why doesn't this stupid text show!!! ####
cat("Time series header:", user$stationtype, stationname(), user$stationvar, "\n")
if (isTRUE(stationname() > "")){
"Time series plot:"
} else if (isTRUE(user$stationvar != "NONE")){
"Click station marker to view data:"
} else {
""
}
})
I tried to make a reprex but for some reason it works fine here. Can't figure out what the problem is! Help!
library(shiny)
library(leaflet)
library(sf)
library(shinyjs)
library(htmlTable) # for htmlTable
library(plotly)
library(dplyr)
library(tidyr) # for drop_na
library(stringr)
library(tibble) # for column_to_rownames
library(htmltools) # for htmlDependency
library(htmlwidgets) # for onRender
library(knitr)
library(purrr) # for negate
library(lubridate)
library(rhandsontable)
library(rlang) # for big-bang !!!
ui <- tagList(
actionButton("addone", "Add One"),
textInput("textin", "Enter X"),
textOutput("total")
)
server <- function(input, output, session){
user <- reactiveValues(
n = 0
)
observeEvent(input$addone, {
cat("increment user$n\n")
user$n <- user$n + 1
})
observe({
cat("input$textin :", input$textin, "\n")
isolate({
if (input$textin == "X"){
user$n <- isolate(user$n) + 1
cat("user$n <-", user$n, "\n")
}
})
})
output$total <- renderText({
cat("display user$n\n")
user$n
})
}
shinyApp(ui, server)