title: How do I make sure that a shiny reactive plot only changes once all other reactives finish changing?
body: <p>I have a shiny app in which the user selects a bunch of inputs, such as the x range, y range, types of scaling and the selection of a particular subset of the data set through a drop down list. </p>
  
  <p>This is all done through the use of reactives. X and Y range slider inputs react to changes in the selection of the data set because the minimum and maximum have to be found again. This takes maybe about 1-2 seconds while the shiny app is working and the user chooses a different option in the drop down list. During those 1-2 seconds, the plot switches to plotting the selected new subset of data with the old x and y range before quickly switching to the correct plot once the x and y range sliders change.</p>
  
  <p>A fix would be to just refresh the plot on a button by isolating everything else. But would there be a way to keep the plot reactive to changes, but just wait until all the dependent things have finished calculating?</p>
  
  <p>Thanks</p>
  
  <p>This is the plot:</p>
  
  <pre><code>output$plot1 &lt;- rCharts::renderChart2({    
      if(!is.null(input$date_of_interest) &amp;&amp; 
           !is.null(input$xrange) &amp;&amp; 
           !is.null(input$yrange) &amp;&amp;
           !is.null(data()) &amp;&amp;
           isolate(valid_date_of_interest())) {
        filtered_data&lt;- dplyr::filter(isolate(data()), id==input$choice)
        p &lt;- tryCatch(plot_high_chart(
                             data,
                             first_date_of_interest = input$date_of_interest, 
                             ylim = input$yrange,
                             xlim = input$xrange), 
                      error = function(e) e, 
                      warning = function(w) w)
        if(!inherits(p, "error") &amp;&amp; !inherits(p, "warning")) {
          return(p)
        }
      } 
      return(rCharts::Highcharts$new())
    })
  </code></pre>
  
  <p>and x range(y range is similar):</p>
  
  <pre><code>output$xrange &lt;- renderUI({
      if(!is.null(input$date_of_interest) &amp;&amp; 
         !is.null(input$choice) &amp;&amp;
         !is.null(valid_date_of_interest()) &amp;&amp;
         isolate(valid_date_of_interest())) {
            temp_data &lt;- dplyr::filter(isolate(data()), date == input$date_of_interest)
            temp &lt;- data.table::data.table(temp_data, key = "child.id")
            the_days &lt;- as.double(as.Date(temp$last.tradeable.dt) - as.Date(temp$date))
            min_days &lt;- min(the_days,na.rm=TRUE)
            max_days &lt;- max(the_days,na.rm=TRUE)
            sliderInput("xrange", 
                        "Days Range (X Axis)", 
                         step = 1,
                         min = 0,
                         max = max_days + 10,
                         value = c(min_days,max_days)
        )
      }
    })
  </code></pre>
  
  <p>and the input choice:</p>
  
  <pre><code> output$choice&lt;- renderUI({
      selectInput("choice", 
                  "Choose:", 
                  unique(data$id),
                  selected = 1    
      )
    })
  </code></pre>
  
  <p>Some direction and suggestions to implement would be useful. I've thought about having global variables such as x_range_updated, y_range_updated, that are set to false in the code for output$choice and then set to true in the code for output$xrange, etc. And then have plot1 depend on them being true. Other suggestions to approach this problem would be appreciated.</p>