Skip to content

Changes to reactive values not displaying accurately #36

Description

@jcheng5

Set options(shiny.reactlog=TRUE), then run this app:

library(shiny)

ui <- fluidPage(
  uiOutput("ui")
)

server <- function(input, output, session) {
  output$ui <- renderUI({
    numericInput("x", "x", 5)
  })
  
  observe({
    print(input$x)
  })
}

shinyApp(ui, server)

If you don't touch any inputs, you'll see that the input$x value is 5. Now launch the reactlog. It'll say that input$x is NULL.

I don't repro this problem without using the renderUI; it's almost like the initial value being NULL causes the next value to be lost.

For what it's worth, the 063-superzip example app is where I saw this first; input$map_bounds stays NULL longer than it should.

Activity

  1. added a commit that references this issue on May 7, 2019
    8a07314
  2. added a commit that references this issue on May 8, 2019
    d5ad7ee
  3. mattflor commented on Jan 23, 2020

    @mattflor

    Has this issue really been fixed? I added a numericInput in the ui function to @jcheng5's app to compare the behavior with the numericInput created via renderUI in the server function. What I observe is that without having touched any inputs the reactlog looks fine. input$x is initialized with NULL but then picks up the value of 5.
    However, when I DO touch the x input and step it to up to 6, and then launch reactlog again, the info displayed in the dependency graph and the info in the status bar do not match at step 13. The status bar says "Step: 13 input$x has a new value: int 6" while the graph says "input$x - 'int 5'". The graph info is the correct one.
    That discrepancy does not occur with input$y.

    library(shiny)
    library(reactlog)
    
    options(shiny.reactlog = TRUE)
    
    ui <- fluidPage(
        uiOutput("ui"),
        numericInput("y", "y", 10)
    )
    
    server <- function(input, output, session) {
        output$ui <- renderUI({
            numericInput("x", "x", 5)
        })
        
        observe(label = "observe x", {
            print(paste("x:", input$x))
        })
        
        observe(label = "observe y", {
            print(paste("y:", input$y))
        })
        
    }
    
    shinyApp(ui, server)
    
  4. schloerke commented on Jan 23, 2020

    @schloerke
    Collaborator

    I believe this is a bug with the status bar within reactlog.


    Thank you for the reproducible steps! If you hit the l key while the reactlog is open, it'll display the raw log value. The raw log value states the value to be int 5, while the status bar states it to be int 6.

    Screen Shot 2020-01-23 at 10 38 33 AM


    The value int 6 should not appear until after the second idle stage ~ Step 20.

    Screen Shot 2020-01-23 at 10 44 03 AM

  5. added a commit that references this issue on May 11, 2026
  6. added a commit that references this issue on May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions