title: Showing "Loading" when download button is running in R server and hidden messages when finishing the task
body: <p>I am trying to create a shiny app which can download the files from the database but the querying time is very long so I want to let the user know that after they press the button, the web browser shows &quot;loading to the user&quot; and after finished download, &quot;loading&quot; will be hidden.</p>
  <p>This is my code:</p>
  <pre><code>if (interactive()) {
    
    library(shiny)
    library(shinyWidgets)
    
    ui &lt;- fluidPage(
      downloadBttn(
        outputId = &quot;downloadData&quot;,
        style = &quot;bordered&quot;,
        color = &quot;primary&quot;
      )
    )
    
    server &lt;- function(input, output, session) {
      data_xi &lt;- data.frame(s = c(1:3),r = c(4:6), x =c(19:21))
      
      observeEvent(input$downloadData, {
        showModal(modalDialog(&quot;Loading&quot;, footer=NULL))
        
        filename = function() {
          paste('data-', Sys.Date(), '.csv', sep='')
        }
        
        content = function(file) {
          write_xlsx(data_xi,file)
        }
        
        removeModal()
      })
    }
    shinyApp(ui, server)
    
  }
  </code></pre>