Recursion Error: Maximum Call Stack Size Exceeded

I don’t think I’m doing any recursive calls. To include a clone or code snippet I’ll have to do a bit of development actually…

I’m creating what is debug printing out as a ‘list’, shown below. It’s the product of instantiating several form components from code. Any time I try to pass this to a server function, at all, even just to pass it and ‘see’ it on the server side… I get the recursion error. I suspect I’m going to have to create an app to share this as a clone to figure out what’s going on.

[{'page': 'cover', 'title': 'INTEL Package Title', 'date': '13 June 2022', 'logo': <anvil.LazyMedia object>}, {'page': 'fndg1', 'title': 'Finding ONE Title', 'height': 50, 'logo': <anvil.LazyMedia object>, 'objects': [{...}, {'name': 'Main Body', 'x': 29, 'y': 345.5, 'type': 'TextArea', 'text': 'Finding One Body', 'height': 50}, {'name': 'subtitle', 'x': 29, 'y': 285, 'type': 'TextArea', 'text': 'Finding ONE SubTitle', 'height': 45}, {'name': 'img1', 'height': 200, 'width': 200, 'source': <anvil.FileMedia object>, 'x': 200, 'y': 500, 'type': 'Image'}]}, {'page': 'fndg2', 'title': 'Finding Two Title', 'height': 50, 'logo': <anvil.LazyMedia object>, 'objects': [{...}, {'name': 'Main Body', 'x': 29, 'y': 345.5, 'type': 'TextArea', 'text': 'Finding Two Body', 'height': 50}, {'name': 'subtitle', 'x': 29, 'y': 285, 'type': 'TextArea', 'text': 'Finding Two SubTitle', 'height': 45}]}, {'page': 'recc1', 'title': 'Recommendation One Title', 'body': 'Recommendation One Body', 'logo': <anvil.LazyMedia object>}]

Are you using portable classes?

I don’t think so? I don’t know what portable classes are… sounds like I need to study up on this

Then I guess you don’t use Anvil Docs | Portable Classes

I asked because I have seen this error when creating recursive portable classes.

Well, then I need to see more code. Perhaps a clone link is required here.

It’s hard for me to imagine how to share a clone of this without hours of work to strip down to the pieces causing this… is there a way to print/debug/‘see’ the call stack… to try to determine what is either piling up, or ‘recursing’?

I see this with the javascript Console open:

That looks like the object contains itself.

Any time you see {…} in the repr of a dict it means it’s self referencing. And you have that at objects: [{…},.

If it doesn’t need to reference itself removing the self reference should fix the issue.

VERY helpful clue… I had noticed that… but could not figure out what that {…} meant… I did strip the app down to a minimal representation here (clone below). The steps that recreate the error are outlined below as well. FWIW I’m building a dynamic report builder of sorts, for example, the Add Image button creates an image and the controls I’ve created there at the bottom let the user select the object and resize it and/or move it around. A poor-man’s powerpoint if you will. I’ll go ahead and post this clone while I hone in on your identification of an issue. Thanks in advance

  1. Enter text into the report title outlined by dashed red line

  2. Enter text into the Report Date outlined by dashed red line

  3. Click the “Executive Summary” button
    a. Enter text into the Executive Summary area outlined by dashed red line

  4. Click the “Render PDF” button
    a. This button will print the INTEL (list of dictionaries) that is being built (object) in the browser, then it passes that object to a server function that will simply print that object again.

  5. Click the “Add Finding” button

  6. Click the “Finding 1” button
    a. Enter text into the Title ‘field’ outlined by dashed red line
    b. Click the “Add Sub-Title” button
    c. Enter text into the subtitle field
    d. Enter text into the body field

  7. Click the “Render PDF” button
    a. This button will print the INTEL (list of dictionaries) that is being built (object) in the browser, then it passes that object to a server function that will simply print that object again.

AT THIS JUNCTURE THERE ARE NO ERRORS

  1. Click the “Recommendation 1” button

  2. Click the "Render PDF button"

ERROR: There is something about the what the Recommendation Button does that causes the RecursionError: Maximum call stack size exceeded. Some combination of events is causing this, but I cannot determine where I’m causing recursion.

https://anvil.works/build#clone:BLQ6VKFKUHPUMBMI=67PR42MSTO2X2KFCHLG5WK25