Hi!
I am working on a shiny app that periodically checks a Github repo where I store the data for new pushes (i.e. new data arrived), but only reruns the calculations if new data arrived.
My problem is that if I use invalidateLater in a reactive to check for the push time, and I use that reactive to trigger a reactiveEvent that runs the calculations, the reactiveEvent is triggered even, if the push time itself did not change.
I made a small reprex with a constant push time.
Do you have any suggestions on how to solve this problem?
Thanks!
shinyApp(
ui = fluidPage(
plotOutput("plot")
),
server = function(input, output, session) {
# Get latest update time
push_time <- reactive({
invalidateLater(1000)
# In the real code here I get the latest push
# time from a Github repo
# For reprex here is a unix timestamp
1601627006
})
# Update data only if push_time is updated
# i.e. new data arrived
my_data <- eventReactive(push_time(), {
runif(1000, 0, 1)
})
# Render plot
output$plot <- renderPlot(plot(my_data()))
}
)