earlSt1 / vtt-compendium-folders

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

Broken Update Compendium #101

Closed TarionT closed 3 years ago

TarionT commented 3 years ago

Describe the bug I have several actor comendiums with folders but beginning with version 2.3.5 i have a message that open the actor comepdium an say updatening folder structur and the compendium overlay will closed imediatly after that message apears.

The thing is this only happends on actor compendiums, all other comendiums scenes and journalitem works like a charm.

The error message in the console: fic-folders.js:10 Uncaught (in promise) TypeError: Cannot read property 'update' of undefined at Function.packUpdateEntity (fic-folders.js:10) at async fic-folders.js:647

To Reproduce it happend al the time even with no moduls expect comepndium folders and lib... activ

Information

earlSt1 commented 3 years ago

Thanks this has been mentioned by other users, i'll push out a fix later this evening

earlSt1 commented 3 years ago

Fixed in v2.3.51

sneat commented 3 years ago

I think this needs to be reopened @earlSt1 - the issue is System dependent (note that dnd5e is fine).

Running v2.3.51 System: DSA/TDE (the dark eye)

Exporting folder structure (shown below) to an empty compendium (world or module) results in:

Uncaught (in promise) TypeError: Cannot read property 'update' of undefined
    at Function.packUpdateEntity (fic-folders.js:10)
    at async fic-folders.js:647

I think there are two issues here:

  1. The #[CF_tempEntity] actor has no data flags attached to it when it gets added to the compendium.

image image

  1. The entity that gets passed into removeOrUpdateFolderIdForEntity https://github.com/earlSt1/vtt-compendium-folders/blob/082-update/fic-folders.js#L895 has a field called _id rather than id so when it gets passed back to the updateData, it ends up trying to update an undefined entity (because the id is undefined).
earlSt1 commented 3 years ago

image Looks like the system is causing issues, it's clearing all flags when you create an actor (which wipes all CF folder data). I'll raise it with the systems guys

Weilef commented 3 years ago

Error message With only the compendium folder module enabled and attempting to export folder structure, this happens. I have attempted it with only a single folder or more, and the same error occurs.

Nothing within the compendium appears to update when this happens.

earlSt1 commented 3 years ago

Error message With only the compendium folder module enabled and attempting to export folder structure, this happens. I have attempted it with only a single folder or more, and the same error occurs.

Nothing within the compendium appears to update when this happens.

Hi, which system + version are you using?

Weilef commented 3 years ago

Version 8.9 of Foundry with the latest version of the module with no other module running on dnd5e. I'm not sure if this completely resolves the issue (it looks like it so far) but I put an if(document) statement right where the undefined variable error message was located. It took away the error message and compendium was exporting again.

if(document) return await document.update....

It was occurring with anything I was attempting to export that had a folder: scenes. actors, and items

earlSt1 commented 3 years ago

Aha, I think I've identified the issue, was passing the incorrect id into that function.

Can you try installing the test version of CF to see if it fixes it for you? To do so, uninstall CF and install this version using the manifest input at the bottom of the install screen: https://raw.githubusercontent.com/earlSt1/vtt-compendium-folders/082-update/test/module.json

Weilef commented 3 years ago

Aha, I think I've identified the issue, was passing the incorrect id into that function.

Can you try installing the test version of CF to see if it fixes it for you? To do so, uninstall CF and install this version using the manifest input at the bottom of the install screen: https://raw.githubusercontent.com/earlSt1/vtt-compendium-folders/082-update/test/module.json

I receive this error message.

fic-folders.js:1136 Uncaught (in promise) TypeError: Cannot read property 'flags' of undefined at Function.exportSingleFolderToCompendium (fic-folders.js:1136) at async Function.recursivelyExportFolders (fic-folders.js:1103) at async Function.recursivelyExportFolders (fic-folders.js:1117) at async callback (fic-folders.js:1016)


    if (existingFolder){
        // Use existing
        folderId = existingFolder.data.flags.cf.id
        path = existingFolder.data.flags.cf.path  (X)
earlSt1 commented 3 years ago

Ahhhhh, the manifest was wrong, I must have accidentally merged it in from the other branch

Can you try and install again using the same methods?

Weilef commented 3 years ago

Ahhhhh, the manifest is wrong, I must have accidentally merged it in from the other branch

Can you try and install again using the same methods?

It's working. Thank you for the quick fix!

earlSt1 commented 3 years ago

Talked through the issue with @TarionT, issue is now fixed in v2.3.53