"Too much recursion" error when hiding a Dash Table
ndrezn opened this issue · 2 comments
ndrezn commented
When using a Dash Table which can be hidden, e.g. by changing the style or nesting inside of a dbc.Collapse
component, an initially hidden Dash Table with fill_width
set to True
will throw an indecipherable too much recursion
error.
Minimal example
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_table
import pandas as pd
app = dash.Dash()
server = app.server
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/solar.csv")
app.layout = html.Div(
[
html.Div(
children=[
dash_table.DataTable(
id="table",
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict("records"),
fill_width=False,
)
],
id="table-container",
style={"display": "none"},
),
html.Button(children="Show table", id="toggle", n_clicks=0),
]
)
@app.callback(
[Output("table-container", "style"), Output("toggle", "children")],
[Input("toggle", "n_clicks")],
)
def hide_table(n_clicks):
if n_clicks % 2 == 1:
return {"display": "none"}, "Show table"
return None, "Hide table"
if __name__ == "__main__":
app.run_server(debug=True, port=8050)
Screen recording
Error (with table initially hidden)
error.mov
Expected behavior (with table initially visible)
expected_behavior.mov
jonas37 commented
Same issue here, really yould like to see a fix
LeoWanty commented
I have similar issue on Dash Table but I'm not trying to hide the table.
At first glance, it looks to be linked to fixed_row
options and column widths specification (I know there are some unwanted behaviors on such combination of styles). I'll come back later when I get the time to investigate deeper the source of the issue on my side.