Closed plutonium-94 closed 1 year ago
Here is a demo application:
# -*- coding: utf-8 -*- from dash import html, dcc, Output, Input, State from dash.exceptions import PreventUpdate from dash_extensions.enrich import DashProxy, OperatorTransform, OperatorOutput, Operator app = DashProxy(__name__, transforms=[OperatorTransform()]) app.layout = html.Div([ dcc.Store(id='store', data={}), html.Div(id='output'), html.Button('update', id='button'), ]) @app.callback(OperatorOutput('store', 'data'), Input('button', 'n_clicks'), State('store', 'data')) def update_store(n_clicks, data): if not data and n_clicks: return Operator().dict.update({'a': 1}) raise PreventUpdate @app.callback(Output('output', 'children'), Input('store', 'data')) def update_output(data): return str(data) if __name__ == '__main__': app.run_server(debug=True)
When the update button was clicked, the data in store was actually updated, so the following messages in browser console were erroneous:
Received unknown action for component store_data. {opr: 'dict_update', pth: Array(0), obj: {…}} Update will be skipped.
Add a break; above https://github.com/thedirtyfew/dash-extensions/blob/2d03763b42b82fc827f50d0527d236a04a819921/dash_extensions/enrich.py#L1558 may solve the issue.
break;
Ah yes, that's obviously a bug. Thanks for the correction :)
Here is a demo application:
When the update button was clicked, the data in store was actually updated, so the following messages in browser console were erroneous:
Add a
break;
above https://github.com/thedirtyfew/dash-extensions/blob/2d03763b42b82fc827f50d0527d236a04a819921/dash_extensions/enrich.py#L1558 may solve the issue.