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

Circular callbacks with multiple callbacks seem to work #230

Open
rcqls opened this issue Oct 20, 2023 · 2 comments
Open

Circular callbacks with multiple callbacks seem to work #230

rcqls opened this issue Oct 20, 2023 · 2 comments

Comments

@rcqls
Copy link

rcqls commented Oct 20, 2023

Hi, just reading the documentation about circular callbacks within the same callback which indeed does not work for dash.jl , I gave a try with multiple callbacks and everything was fine except the check of circular callbacks that leads to "circular dependencies" error.

  1. Is it known that the following example is working?
  2. Is it then possible to detect that this is no more a "circular dependencies" error?
  3. Maybe the above example is only working on macos (my current OS)? Are there some people checking if the example is working too?
using Dash, Dates

external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]

app = dash(external_stylesheets=external_stylesheets, suppress_callback_exceptions=true)

app.layout = html_div() do
    dcc_slider(
        id="slider-circular",
        min=0,
        max=20,
        marks=Dict(i => "$i" for i in 0:20),
        value=3,
    ),
    dcc_input(id="input-circular", type="number", min=0, max=20, value=3)
end

callback!(
    app,
    Output("input-circular", "value"),
    Input("slider-circular", "value"),
) do  slider_value
    value =  slider_value
    return value
end
callback!(
    app,
    Output("slider-circular", "value"),
    Input("input-circular", "value"),
) do input_value
    value = input_value
    return value
end
run_server(app, "0.0.0.0", debug=true)
@etpinard
Copy link
Collaborator

etpinard commented Oct 20, 2023

Unfortunately, support for input-output circular callbacks haven't made their way to Dash.jl yet. See #200 for a WIP list of all dash.py vs Dash.jl feature comparison.

Judging from plotly/dash#1525, I think getting this to work would only require us to skip some of the callback validation logic on the Julia side.

@rcqls
Copy link
Author

rcqls commented Oct 20, 2023

Unfortunately, support for input-output circular callbacks haven't made their way to Dash.jl yet. See #200 for a WIP list of all dash.py vs Dash.jl feature comparison.

Judging from plotly/dash#1525, I think getting this to work would only require us to skip some of the callback validation logic on the Julia side.

What you mean is with only one callback! call as in the example given in the documentation. But do you confirm that it works with 2 calls callback! as in my example? At some point I think that with 2 calls callback!it is more natural to express the circular callback. Only the error message about 'circular dependencies' is a bit annoying even though it is not a major 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