Saren Tasciyan
Saren Tasciyan

Reputation: 483

Shiny module updateTextInput or more generally all update*Inputs don't work despite the session

In the same Shiny App, I have two modules, which have a similar architecture with an observeEvent. Both observeEvents update the input fields. In one of the modules this action works just fine. In the other one it does not work for some reason.

I think this must be a weird bug but is there any way to even investigate it?

module_ui = function(id){
  ns = NS(id)
  ...
  textInput(ns("textid"), ...)
  ...
}
module_server = function(id){
  moduleServer(id,
    function(input, output, session){
      ...
      observeEvent(reac(), {
        print("trigger indicator")
        updateTextInput(session, "textid", value = reac())
      }
      ...
    }
}

Upvotes: 1

Views: 272

Answers (2)

Saren Tasciyan
Saren Tasciyan

Reputation: 483

My mistake, there was an error, which I saw in Firefox but not in RStudio's browser. One of the sub-submodules did not manage to set an input value, which was an empty vector. This blocked the rest of the javascript action. Therefore, no values were displayed.

Lesson: if update*Input does not work, this can be due to unnoticed errors in other modules.

Upvotes: 1

A-A-ron
A-A-ron

Reputation: 27

Given the situation you are describing, i would try printing rec(), i am assuming this is a reactive value, in the observeEvent() to see what its value the updateTextInput is executing.

I suspect there is something up it when it is passed into the observeEvent causing it to set to the same value.

Upvotes: 0

Related Questions