earlSt1 / vtt-compendium-folders

Collapsable folders in the compendium directory and folder structures inside compendiums for FoundryVTT
21 stars 18 forks source link

JS error on Foundry load with Compendium Folders and Token Attacher modules #131

Closed TheGreatRedDuke closed 2 years ago

TheGreatRedDuke commented 2 years ago

Describe the bug Foundry is throwing a JS error when loading both the Compendium Folders and Token Attacher modules at the same time. I'm not sure if this is an issue steaming from Compendium Folder or Token Attacher, but the error indicates Compendium Folders.

I'm running into other strange behavior that may be related to Compendium Folders functionality, but I believe it may be a side effect of this JS error and can be reviewed after this issue is resolved (if it remains).

To Reproduce Load a world using both the Compendium Folders and Token Attacher modules, then check Dev Tools.

Expected behavior No JS errors.

Screenshots The JS error I'm receiving on Foundry load: js-error-on-load

fic-folders.js:1469 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'folders') [Detected 1 package: compendium-folders] at Function.importFolderData (fic-folders.js:1469:52) at fic-folders.js:472:34 at Function._call (foundry.js:294:14) at Function.callAll (foundry.js:253:12) at ClientDatabaseBackend.callback (foundry.js:10273:13) at foundry.js:10212:43 at Array.map (<anonymous>) at ClientDatabaseBackend._handleUpdateDocuments (foundry.js:10212:33) at ClientDatabaseBackend._updateDocuments (foundry.js:10093:17) at async Function.updateDocuments (document.mjs:373:21) at async Scene.update (document.mjs:456:21)

Information

*enabling only minimum required modules for this specific integration test:

earlSt1 commented 2 years ago

Ah I remember token attacher having to update scenes and stuff automatically after updates. Could you try without CF enabled, then after Token Attacher updates everything re-enabling it and refreshing?

TheGreatRedDuke commented 2 years ago

I can confirm:

  1. Loaded my same game world (with the previously described list of modules), but minus Compendium Folders -- no JS issues.
  2. For good measure, I placed an Token Attached actor in a scene and tested that working -- no issues; removed the token.
  3. Enabled Compendium Folders again, this time I did not receive any JS errors on load.
  4. Place the Token Attached actor back in a scene to test -- no issues there either.

So that seems to have fixed up that specific issue. Is this just a process I should repeat each time Token Attacher updates?

earlSt1 commented 2 years ago

Yeah from what i understand occasionally Token attacher will go through all scenes and perform an update on them after updating to a newer version. Disabling CF temporarily is a workaround for now but I will definitely prioritise this issue as it will get a bit annoying having to disable CF to continue.

TheGreatRedDuke commented 2 years ago

Sounds good! Thank you!

earlSt1 commented 2 years ago

Hi, sorry for the long wait.

Can you try installing this test version of Compendium Folders and seeing if you still get the error?

To install you need to uninstall your current version and install this one using the manifest text box on the install module screen: https://raw.githubusercontent.com/earlSt1/vtt-compendium-folders/09x-update/test/module.json

earlSt1 commented 2 years ago

Should be fixed as of v2.4.4 (similar issue #141)

TheGreatRedDuke commented 2 years ago

Hi, sorry, I've been away, and just got back to see this. But I can confirm I'm not longer seeing the error in my tests. Thanks!