Dash partial updates: is it possible to add new traces to patched_fig?

I’m currently testing my app with all updates, that came with dash 2.9.2 and 2.9.3
It seems to me, that one cannot add new data traces to a Patch() object. Is that right?
patched_fig = Patch()
Since patched_figure is an immutable tuple, one cannot append new go.Scatter objects to it.
It is neither possible to add a new trace like this:
patched_fig['data'] += (go.Scatter(...), )
Is there any implemented (or hacky) way to achieve this?

Hello @luggie,

This is possible.

You need to be using the append argument. As the figures data is a list and not a string.

The way I understand the documentary, this is not what I was asking.
With append, data can be appended to an existing trace. Right?

current_time = datetime.datetime.now()
random_value = random.randrange(1, 30, 1)
patched_figure = Patch()

What I would need, is to add a new go.Scatter object like it is done otherwise without partial property updates with
fig.add_trace(go.Scatter(name='name', ...))
This is because for my application, I need to give the new trace a name, that I’m using to have the ability to delete the trace afterwards.
Is this also possible with partial property updates like is implemented now?

Adding a trace is the same as adding a new dataset. At least this is the way I understand it.

Using figure add_trace is just a way to make it easier to understand what it is doing (it might also do some adjusting of the layout, if effected)

To do the append, you could try like this:

fig = Patch()
return fig