Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Too much recursion error" when using dash datatable and dash bootstrap modal

So I can’t show my code because it’s for work, but I suddenly started getting a “Too much recursion error.” I hadn’t started getting this error until two weeks ago. So I started to hunt down in my code where this error exactly occurred.

I currently have a button above my main datatable that triggers a modal (dash bootstrap) that holds a smaller datatable. I was getting the error when ever this modal was created, so I emptied the app call back to just be like this (sorry for the formatting I’m on my phone)

@app.callback(
Output(“modal-edit”,“is-open”), Input (“edit-button”, “n-clicks”) )

def toggle_modal(edit):
    if edit:
       return True
    else:
        False

Just to see if the modal opening was the problem somehow, I also cleared the modal so it was just a blank modal that was opening. No error occurred so I added back in one datatable in the modal body (the data table is empty, the idea is the user would select x # of rows and then have 3 preset buttons to modify the data which would them be inserted back into the larger datatable), and immediately the amount of time needed to open the modal increases significantly and I got the error again of “Too much recursion.”

I had this exact modal and button setup for around 2ish weeks before the error started occuring and I’m unsure of why the error is happening when these two objects interact with eachother. If anyone knows a workaround it’d greatly be appreciated

like image 337
hyphenFG Avatar asked Mar 16 '26 23:03

hyphenFG


1 Answers

I had a similar issue, but my DataTable is inside a Collapse Component. I had to change the fill_width property of the datatable to True, now it is working.

like image 124
abc Avatar answered Mar 18 '26 11:03

abc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!