code: def test_grbs002_wrapped_graph_has_no_infinite_loop(
      dash_dcc, is_eager
  ):
      df = pd.DataFrame(np.random.randn(50, 50))
      figure = {
          "data": [
              {
                  "x": df.columns,
                  "y": df.index,
                  "z": df.values,
                  "type": "heatmap",
              }
          ],
          "layout": {"xaxis": {"scaleanchor": "y"}},
      }
  
      app = Dash(__name__, eager_loading=is_eager)
      app.layout = html.Div(
          style={
              "backgroundColor": "red",
              "height": "100vmin",
              "width": "100vmin",
              "overflow": "hidden",
              "position": "relative",
          },
          children=[
              dcc.Loading(
                  children=[
                      dcc.Graph(
                          id="graph",
                          figure=figure,
                          style={
                              "position": "absolute",
                              "top": 0,
                              "left": 0,
                              "backgroundColor": "blue",
                              "width": "100%",
                              "height": "100%",
                              "overflow": "hidden",
                          },
                      )
                  ]
              )
          ],
      )
      call_count = Value("i", 0)
  
      @app.callback(
          Output("graph", "figure"), [Input("graph", "relayoutData")]
      )
      def selected_df_figure(selection):
          call_count.value += 1
          figure["data"][0]["x"] = df.columns
          figure["data"][0]["y"] = df.index
          figure["data"][0]["z"] = df.values
          return figure
  
      dash_dcc.start_server(app)
  
      wait.until(lambda: dash_dcc.driver.title == "Dash", timeout=2)
      sleep(1)
      # TODO: not sure 2 calls actually makes sense here, shouldn't it be 1?
      # but that's what we had as of the 608 fix, PR 621, so let's lock that
      # in for now.
      assert call_count.value == 2
  
      assert dash_dcc.get_logs() == []
  
file_path: dash/components/dash-core-components/tests/integration/graph/test_graph_basics.py
imports: import json
  import pytest
  import pandas
  from multiprocessing import Value, Lock
  import numpy
  from time import sleep
  import plotly.express
  import plotly.graph_objects
  from dash import Dash, Input, Output, dcc, html
  import dash.testing.wait
label_desc: Use image node_id 2 for calling a global function with example usage: test_grbs002_wrapped_graph_has_no_infinite_loop(dash_dcc, is_eager) and returns: figure