excelR icon indicating copy to clipboard operation
excelR copied to clipboard

Input object not available on initial render

Open lanceupton opened this issue 2 years ago • 2 comments

Description

The input object corresponding to an excelOutput is not available after the initial render of the table, and before making any modifications to the table, or invalidating. It's almost like the input isn't binded until the output is invalidated at least once.

To Reproduce

In the included reprex:

  1. Click the Invalidate Input button to invalidate the excelOutput block.
  2. Observe that, as expected, the excelOutput renders.
  3. Observe that, unexpectedly, the datatableOutput (which simply conducts the input object from the excelTable), does not render. This is a side effect of the input object not being available.
  4. Click the Invalidate Input button to invalidate the excelOutput block again.
  5. Observe that, as expected, both outputs render.

Reprex


library(shiny)
library(excelR)

shinyApp(
  ui = fluidPage(
    tags$br(),
    fluidRow(column(width = 12, actionButton("btn", "Invalidate Input"))),
    tags$hr(),
    fluidRow(
      column(width = 6, excelOutput("tab1")),
      column(width = 6, dataTableOutput("tab2"))
    )
  ),
  server = function(input, output, session) {
    input_data <- eventReactive(input$btn, sample(1:50, 10))
    output$tab1 <- renderExcel(excelTable(data.frame(vals = input_data())))
    excel_data <- reactive(excel_to_R(input$tab1))
    output$tab2 <- renderDataTable(excel_data())
  }
)

Client Info

  • OS: Windows
  • Browser: Edge
  • excelR version: b46f7d1b20a2bc3cb50bda73bedde53b54fe5772

Session Info

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] excelR_0.4.0 shiny_1.7.3 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        magrittr_2.0.1    xtable_1.8-4      R6_2.5.1          rlang_1.0.2       fastmap_1.1.0     tools_4.1.2       cli_3.3.0        
 [9] jquerylib_0.1.4   htmltools_0.5.2   ellipsis_0.3.2    yaml_2.2.1        digest_0.6.28     lifecycle_1.0.1   later_1.3.0       sass_0.4.0       
[17] htmlwidgets_1.5.4 promises_1.2.0.1  rsconnect_0.8.24  cachem_1.0.6      mime_0.12         compiler_4.1.2    bslib_0.3.1       jsonlite_1.7.2   
[25] httpuv_1.6.3      renv_0.15.5    

lanceupton avatar Nov 28 '22 15:11 lanceupton