Skip to content

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

Closed

Description

@daattali

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

Activity

  1. daattali commented on Oct 27, 2021

    @daattali
    ContributorAuthor

    @HammadTheOne is this fixed?

  2. HammadTheOne commented on Oct 27, 2021

    @HammadTheOne
    Contributor

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

  3. daattali commented on Oct 28, 2021

    @daattali
    ContributorAuthor

    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

  4. HammadTheOne commented on Oct 28, 2021

    @HammadTheOne
    Contributor

    image

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

  5. daattali commented on Oct 28, 2021

    @daattali
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions