plotly / Dash.jl

Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Circular callbacks with multiple callbacks seem to work

rcqls opened this issue · comments

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)

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.

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.