earlSt1 / vtt-compendium-folders

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

CF causes errors in game systems providing a custom compendium directory app #184

Open gizmo2342 opened 1 year ago

gizmo2342 commented 1 year ago

CompendiumFolders: v2.5.5 SWADE: v2.0.6

The assumption that all Compendium Directory Windows contain the searched element may not be correct for all Game Systems. (i.e. SWADE uses a complete replacement for Journal Compendiums) Thus you should check if the query found an element before continuing with your work.

grafik

fic-folder.js:944

        Hooks.on("renderCompendium", async function (e) {
            let packCode = e.metadata.id;
            const compendiumWindow = document.querySelector(
                ".compendium.directory[data-pack='" + packCode + "']"
            );

By the way: e.element contains the DOM element of the entire Compendium Window in question. I'd recommend you start your search there.

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'querySelector')
[Detected 1 package: compendium-folders]
    at Function.createFolderWithinCompendium (fic-folders.js:1781:30)
    at Function.recursivelyCreateFolders (fic-folders.js:1989:24)
    at Object.fn (fic-folders.js:983:30)
createFolderWithinCompendium @ fic-folders.js:1781
recursivelyCreateFolders @ fic-folders.js:1989
(anonymous) @ fic-folders.js:983
await in (anonymous) (async)
#call @ foundry.js:724
callAll @ foundry.js:681
_render @ foundry.js:5112
await in _render (async)
render @ foundry.js:5026
render @ foundry.js:13930
(anonymous) @ compendium-folders.js:670
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2

Kind regards, Martin (Ulisses Spiele)

PS: Thanks for your work.