plotly / dash-renderer

OBSOLETE has been merged into dash
https://github.com/plotly/dash
MIT License
97 stars 32 forks source link

callbacks with multiple outputs aren't fired on page load? #168

Closed chriddyp closed 5 years ago

chriddyp commented 5 years ago

https://community.plot.ly/t/possible-bug-with-outputs-and-square-brackets-not-being-rendered-on-page-load/22806

alexcjohnson commented 5 years ago

AFAICT this works fine. Here all 3 divs show 'a':

import dash
import dash_html_components as html
from dash.dependencies import Input, Output

app = dash.Dash(__name__)
app.layout = html.Div([
    html.Div('a', id='a'),
    html.Div('b', id='b'),
    html.Div('c', id='c')
])

@app.callback(Output('b', 'children'), [Input('a', 'children')])
def b(a):
    return a

@app.callback([Output('c', 'children')], [Input('a', 'children')])
def c(a):
    return [a]

if __name__ == '__main__':
    app.run_server(debug=True)