I'm trying to make a live updating Heatmap, but jupyter-dash freezes, errors appear, and then the jupyter kernel dies

Hello! :wave: I am trying to make a live updating heatmap using Jupyter Dash. My main requirement is that dash works equally well with both small dataframes and large ones (several million elements).
So I decided that the application should be as simple as possible. An example of my code implementation is below:

# Build App
app = JupyterDash(__name__)
app.layout = html.Div(
        dcc.Graph(id="heatmap", animate=True),
        dcc.Interval(id="interval-component", interval=1*1000),

@app.callback(Output('heatmap', 'figure'),
              Input("interval-component", "n_intervals"))
def doUpdate(i):
    traces = list()        
#   data.get_result_for_plot() just returns new version of np array
    return {'data': traces}

However the code doesnโ€™t work correctly and first of all the following error pops up: Callback error updating heatmap.figure, and then another one: Error from API call: _reload-hash. On top of that the jupyter kernel dies.
So I have several questions:

  1. what did I do wrong in my implementation?
  2. Is there any way to improve this code?
    For example, I would like to create a figure outside of doUpdate() function and update only z coordinate, to reduce load.

I would be very glad to get advice on these issues. Thanks!