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

Warning thrown when a callback has multiple outputs and multiple inputs and # of inputs is not a multiple of # of outputs #269

Open
daattali opened this issue Sep 22, 2021 · 1 comment

Comments

@daattali
Copy link
Contributor

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).

@daattali
Copy link
Contributor Author

daattali commented Sep 22, 2021

The problem seems to come from this validation check:

dashR/R/utils.R

Lines 458 to 460 in 5c80285

inputs_vs_outputs <- mapply(function(inputObject, outputObject) {
identical(outputObject[["id"]], inputObject[["id"]]) & identical(outputObject[["property"]], inputObject[["property"]])
}, inputs, listWrap(output))

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

@daattali daattali changed the title Warning thrown when a callback has multiple outputs and multiple inputs and the number of inputs != number of outputs Warning thrown when a callback has multiple outputs and multiple inputs and # of inputs is not a multiple of # of outputs Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant