Replies: 2 comments 2 replies
-
Hi @ed2050, Can you, please, share code to reproduce the recursion error? |
Beta Was this translation helpful? Give feedback.
0 replies
-
@falkoschindler haven't found the trigger yet. It consistently causes recursion error in my app. Same setup in test script behaves badly (table doesn't update) but no recursion error. Here's test script. I added things that seem extraneous trying to trigger recursion error. Line marked "doesnt work" adds no rows to table. Same line in my app triggers recursion error. import nicegui
from nicegui import ui
def update (table, data) :
print (f'updating table : { len (data) }')
table.rows [:] = []
table.add_rows (data) # doesnt work, no rows added
#table.add_rows (*data) # this version works fine
table.update ()
# ---
cols = []
fields = [ 'title', 'author', 'year' , 'link' ]
for field in fields :
cols.append ({'name' : field , 'label' : field , 'field' : field , 'align' : 'left'})
data1 = [ { x : 'foo' for x in fields } ] * 50000
data2 = [ { x : 'bar' for x in fields } ] * 50000
# ---
def mainpage () :
ui.label ('Recursion test')
button = ui.button ('update')
table = ui.table (
columns = cols ,
rows = data1 ,
pagination = { 'rowsPerPage' : 20 } ,
)
table.add_slot ('body-cell-link', r'<td class="test" :props="props"> <a :href="props.row.link"> {{props.row.link}} </a> </td>')
button.on ('click', lambda : update (table, data2))
# ---
if __name__ in {"__main__", "__mp_main__"} :
ui.run (dark = True)
mainpage () |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question
Anyone know what causes a recursion depth error in
socketio
withui.table.add_rows
? All I found on boards is #1212 which isn't related (don't use on_air).What happens: page loads fine, I click a button to filter results, call
table.add_rows (rowdata)
, and blamo recursion error. Traceback below, no app files only nicegui and socketio.rowdata
is a list of dicts.If I call
table.add_rows (*rowdata)
instead then no error. Everything works perfectly. However I'm concerned about passing so many args / copying so much data to the callstack. Some tables have 10s of thousands of rows. Passing a ref to rowdata would be better if not for the recursion error.Error message
Beta Was this translation helpful? Give feedback.
All reactions