dashR
dashR copied to clipboard
Warning thrown when a callback has multiple outputs and multiple inputs and # of inputs is not a multiple of # of outputs
The following results in a warning after trying to add the callback:
library(dash)
app <- Dash$new()
app$layout(dashHtmlComponents::htmlDiv())
app$callback(
list(
output("out1", "children"),
output("out2", "children")
),
params = list(
input("in1", "value"),
input("in2", "value"),
input("in3", "value")
),
function(...) {}
)
After some testing, I think it might only happen when there are multiple inputs and multiple outputs and the number is not equal. If you remove one output, it works (1 vs 3). If you remove one input it also works (2 vs 2). If you add an output, it works (3 vs 3).
The problem seems to come from this validation check: https://github.com/plotly/dashR/blob/5c80285b90c24cf15375e6763b56425e9dc530ce/R/utils.R#L458-L460
It also seems that the error happens when:
- number of outputs > 1
- number of inputs > 1
- number of inputs is not divisible by # of outputs