Reputation: 483
In the same Shiny App, I have two modules, which have a similar architecture with an observeEvent
. Both observeEvent
s 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.
ns("id")
for the inputs.update*Inputs
have the session informationobserveEvent
s are triggered in both casesI 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
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
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