Skip to content

columnState causing infinite recursion in the browser with dag>=32 #401

@celia-lm

Description

@celia-lm
Screen.Recording.2025-09-03.at.18.23.38.mov

This happens:

  • Only with debug=True
  • If columnState is set from the start (as part of the grid definition in app.layout).
  • With or without dag enterprise modules.

Traceback fragment:

Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.

Code to reproduce the issue

dash==3.1.1 # it also happens with 3.2.0
dash-ag-grid==33.3.2rc0 # it also happens with 32.3.1 but not 31.3.1

app.py

import dash
from dash import html, callback, Input, Output, State
import dash_ag_grid as dag
import pandas as pd
import os

app = dash.Dash(__name__)

data = pd.read_json('https://www.ag-grid.com/example-assets/olympic-winners.json')
column_defs = [{'headerName': 'Country', 'field': 'country'}, {'headerName': 'Sport', 'field': 'sport'}]
default_col_def = {'maxWidth': 140, 'filter': True, 'hide': True}
column_state = [{'colId': 'country', 'hide': False}]

app.layout = html.Div([
    html.H3(f"dag version: {dag.__version__}"),
    html.Button(id="setColumnState", children="Set columnState to unhide country column"),
    dag.AgGrid(
        id='test-grid',
        columnDefs=column_defs,
        rowData=data.to_dict("records"),
        defaultColDef=default_col_def,
        # columnState=column_state,
    )
])

@callback(
    Output("test-grid", "columnState"),
    Input("setColumnState", "n_clicks"),
    State("test-grid", "columnState"),
    prevent_initial_call=True
)
def setColumnState(_, current_state):
    if _:
        return column_state
    else:
        raise dash.Exceptions.PreventUpdate

if __name__ == '__main__':
    app.run(debug=True)

Metadata

Metadata

Assignees

Labels

P1needed for current cyclebugsomething brokencscustomer success

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions