title: R Shiny - combine reactivePoll to get latest data from DB with force trigger on input date range change
body: <p>Note: The following is not a 'reproducible' example since it relies on a DB back end, but hopefully has enough to provide workable solution ideas.</p>
  
  <p>I want to refresh my data if the database table changes. I am using a reactivePoll() for this one, happily. However, I want the reactivePoll() to forcibly kick in when input date range (or whatever input) changes and not wait for the poll interval to expire. How can I do both?</p>
  
  <p>Here is the general idea of the code I have, but need to be improved to achieve the above result.</p>
  
  <pre><code>getTableData &lt;- function(session, startDate, endDate) {
    tableData &lt;- reactivePoll(
      60000, session,
      checkFunc = function() {
        dbconn &lt;- dbConnect(MySQL(), group = 'mysql')
        query &lt;- dbSendQuery(
          dbconn,
          paste0('SELECT MAX(CREATED_AT) as lastCreated FROM MYDBTABLE;')
        )
        lastFeedback &lt;- dbFetch(query, -1)
        dbClearResult(query)
        dbDisconnect(dbconn)
  
        lastFeedback$lastCreated
      },
      valueFunc = function() {
        query &lt;- paste0(
          "SELECT * FROM MYDBTABLE ",
          "WHERE MY_DATE BETWEEN '",
          startDate, "' AND '", endDate, "';"
        )
        dbconn &lt;- dbConnect(MySQL(), group = 'mysql')
        query &lt;- dbSendQuery(dbconn, query)
  
        refreshedData &lt;- dbFetch(query, -1)
        dbClearResult(query)
        dbDisconnect(dbconn)
  
        refreshedData
      }
    )
  
    return(tableData())
  }
  
  server &lt;- function(session, input, output) {
    output$mydata &lt;- renderDataTable({
      datatable(mydbdata(session, input$mydates[1], input$mydates[2]))
    })  
  }
  
  ui &lt;- fluidPage(
    dateRangeInput(
      'mydates', 'Select Dates:', start = Sys.Date() - 90, end = Sys.Date()
      ),
    dataTableOutput('mydata')
  )
  
  shinyApp(ui = ui, server = server)
  </code></pre>