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

Callbacks are not correctly checking to make sure the same output (id/property pair) is used only once #279

Closed
daattali opened this issue Oct 15, 2021 · 5 comments

Comments

@daattali
Copy link
Contributor

Even though the documentation claims that an output pair can only exist in one callback, and even though there seems to be code that attempts to make this check, this doesn't seem to actually hold true. For example, the following app defines the same callback 3 times with a slightly different return value, and it seems that the last one to be called is the one that sticks:

library(dash)

app <- dash_app()

app %>% set_layout(
  dccInput("text", "test"),
  div(id = "out")
)

app %>% add_callback(
  outputs = output("out", "children"),
  params = input("text", "value"),
  function(data) data
)

app %>% add_callback(
  outputs = output("out", "children"),
  params = input("text", "value"),
  function(data) paste(data, "2")
)

app %>% add_callback(
  outputs = output("out", "children"),
  params = input("text", "value"),
  function(data) paste(data, "3")
)

app %>% run_app()
@daattali
Copy link
Contributor Author

@HammadTheOne is this fixed?

@HammadTheOne
Copy link
Contributor

Yes, this should be fixed through #280. If the same id/prop pair is entered, this will now throw an error.

@daattali
Copy link
Contributor Author

I just tested this and it still doesn't throw any message or error, are you sure it's fixed? Can you run it and confirm

@HammadTheOne
Copy link
Contributor

image

I see this when running it off the latest dev branch version.

@daattali
Copy link
Contributor Author

I may have not run dev, sorry. I'll confirm and close the issue

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

2 participants