plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.

Home Page:https://plotly.com/dash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Patch += operation not working on the patch object.

T4rk1n opened this issue · comments

If you have a patch object for a number prop and try to do patched += 1, the callback will fail with an error, returned non serializable object.

Example:

app = Dash()
app.layout = [dcc.Store(data=0, store="store"), html.Button("click", id="click")]
@app.callback(Output("store", "data"), Input("click", "n_clicks"))
def on_click(_):
    patched = Patch()
    patched += 1
    return patched

Clicking on the button result in the error, it should instead update the store data prop to +1.