Home > Software engineering >  Force Rshiny UI to update UI element before a reactive that depends on it
Force Rshiny UI to update UI element before a reactive that depends on it

Time:04-01

In Rshiny, I understand that we are trying to move away from the paradigm that we execute code 1 line after another and instead execute according to event-driven needs. However, this is causing an issue in an App that I am making to help my lab analyze our data that is causing a crash.

Here is a toy code that reproduces the issue I'm having. In the two code, the input$group1 and input$group2 haven't updated with actual values and pass along an NA, causing the dat variable in the scatterPlot render to be empty. In the real code, initialization is fine since the plot is in another tab, giving time for the update to occur. But while you're on the plot tab and you upload a file different file, the app crashes because its attempting to refer to the value in input$group1 which should be in man() but isn't since man() just updated.

You can also see my attempt to implement the fix found here: enter image description here

  • Related