farling42 / fvtt-pdf-pager

PDF Pager for Foundry
MIT License
6 stars 4 forks source link

Use of flattenObject breaks with Actors #98

Closed bchiu3 closed 1 month ago

bchiu3 commented 1 month ago

The call to flattenObject results in depth limit exceeded when opening up an Actor's page: https://github.com/farling42/fvtt-pdf-pager/blob/65f78858b6b5645f6290f00dff632d5ef7bd80a5/scripts/pdf-editable.mjs#L524

I've tested this with the pf2e edition and it seems to be looping between the value of armorClass, actor, and parent with each call to the call stack. DnD5e has a similar issue, but it seems to be a much bigger loop.

Using latest version of pdfPager, both systems (pf2e and dnd5e), as well as foundry v12.

farling42 commented 1 month ago

Fixed in 0.53.2

bchiu3 commented 1 month ago

This still doesn't work with the pathfinder 2e system but the dnd 5e system works. It seems to run in a near infinite loop due to pathfinder's use of multiple references to actor, crashing the system. It seems removing the stack.delete(v); fixes it, but I'm not sure about the use in other systems: https://github.com/farling42/fvtt-pdf-pager/blob/3207f70756ea93d263c772074220fdb7cabf4707/scripts/pdf-editable.mjs#L425

farling42 commented 1 month ago

One of the initial issues with PF2 is that the basic actor object wasn't placed into the stack Set, so it never found repeated references to the original actor.

farling42 commented 1 month ago

The long list of available fields is now only created once within the DOM of the PDF Pager window, rather than individually on each field - this should massively reduce the size of the loaded DOM.