Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to reactive values not displaying accurately #36

Closed
jcheng5 opened this issue Apr 10, 2019 · 2 comments
Closed

Changes to reactive values not displaying accurately #36

jcheng5 opened this issue Apr 10, 2019 · 2 comments

Comments

@jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Apr 10, 2019

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.

jcheng5 added a commit to rstudio/shiny that referenced this issue May 7, 2019
schloerke added a commit to rstudio/shiny that referenced this issue May 8, 2019
…hanging

Fix rstudio/reactlog#36: Changes to reactive values not displaying accurately
@mattflor
Copy link

@mattflor mattflor commented Jan 23, 2020

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)
@schloerke
Copy link
Collaborator

@schloerke schloerke commented Jan 23, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.