I have just released dash-extensions==0.1.5, which includes the (new) OperatorTransform. The OperatorTransform makes it possible perform partial component property updates, e.g. change the color of a trace,
@app.callback(OperatorOutput("graph", "figure"), Input("dd", "value"))
def change_color(color):
if color is None:
raise PreventUpdate
return Operator()['data'][0]['marker']['color'].assign(color)
without exchanging all data between the client and the server. It also enables list and dict operations, e.g. appending an element to a list,
Hence, for properties that contain a large amount of data, there is potential for (significant) performance improvements. You can read more and see a few complete examples in the documentation
@chriddyp Thanks! To perform an operation, a callback must return an instance of an Operator object. In addition to the (normal) assign operation, the current implementation supports list operations (append, extend, insert, remove, pop, clear, sort, reverse) via the following syntax,
Operator().list.append(...)
and dict operations (set, pop, update, clear) via a similar syntax,
Operator().dict.set(...)
In addition, standard square bracket syntax is supported for targeting sub elements of list or dicts,
In essence, the OperatorTransform works by adding a client side callback, which carries out the operation specified by Operator object returned by the (normal) callback.
@AnnMarieW Thanks! You could use a (normal Python) loop to construct a chain operations, but the current implementation doesn’t include a syntax for a “loop operation”. If you really need to do loops, I think a client side callback might be more appropriate