v11 Debug embedded collection changes

Just a post to track the v11 changes to embedded collections and what needs to be updated in an interim TRL release to support this change.
33 Replies
Nekro Darkmoon
Nekro Darkmoon13mo ago
👌
TyphonJS (Michael)
I'll be getting started with debugging soon. Heh.. Can't even download v11 stable through the running software at the moment / too much server load. Maybe get things going w/ a direct download / re-install.
Nekro Darkmoon
Nekro Darkmoon13mo ago
https://github.com/Pjb518/FoundryVTT-Level-Up-Official/tree/v11 here's a link to our system working v11 branch in case you need a system for testing the regex is correct 🤔 I tested it manually and it works
TyphonJS (Michael)
It's the previous line if (!this.#embeddedNames.has(renderContext)) { return; } that is likely causing things to abort early. So a possible change is:
handleUpdate(renderContext)
{
const match = EmbeddedStoreManager.#renderContextRegex.exec(renderContext);

if (match)
{
const compatName = `${match[1]}${match[2]}`;
if (!this.#embeddedNames.has(compatName)) { return; }

const embeddedName = match[2];
if (!this.#name.has(embeddedName)) { return; }

for (const store of this.#name.get(embeddedName).stores.values())
{
store.index.update(true);
}
}
}
handleUpdate(renderContext)
{
const match = EmbeddedStoreManager.#renderContextRegex.exec(renderContext);

if (match)
{
const compatName = `${match[1]}${match[2]}`;
if (!this.#embeddedNames.has(compatName)) { return; }

const embeddedName = match[2];
if (!this.#name.has(embeddedName)) { return; }

for (const store of this.#name.get(embeddedName).stores.values())
{
store.index.update(true);
}
}
}
Nekro Darkmoon
Nekro Darkmoon13mo ago
will this be out as an interm update or should I update the files manually
TyphonJS (Michael)
Might as well try it and let me know it works. I'm just looking at the code.. Spinning up the next coding session imminently. The less code that needs to change for the interim patch the better. To make things easier on my side I'm going to alter the code manually before pushing the interim release out and not change it in the current committed code to avoid having to merge anything w/ my current dev branch.
Nekro Darkmoon
Nekro Darkmoon13mo ago
I might have better luck testing with the package 🤣 vite caching is making a bit hard to change stuff and test locally 🙃
TyphonJS (Michael)
You can delete .vite-cache I actually changed the location in the Vite config that I provide to put the cache in an obvious top level location. Normally it's in node_modules/vite or something like that. Also just run production builds when testing this and not the dev server; just a head check here on that.
Nekro Darkmoon
Nekro Darkmoon13mo ago
still the same 🤔 it does get triggered properly though now
Nekro Darkmoon
Nekro Darkmoon13mo ago
No description
Nekro Darkmoon
Nekro Darkmoon13mo ago
it's tripping here now
Nekro Darkmoon
Nekro Darkmoon13mo ago
Nekro Darkmoon
Nekro Darkmoon13mo ago
here's an accompanying video
TyphonJS (Michael)
Well.. I'll be getting to it soon. The #name Map holds the actual document name. IE Item / ActiveEffect, so just making sure that the regex match and match[2] is correct / IE log it and perhaps log the keys in #names as a sanity case. I am getting things started here instead of looking at the code though, so hopefully figure it out soon.
Nekro Darkmoon
Nekro Darkmoon13mo ago
thanks a bunch ❤️
Nekro Darkmoon
Nekro Darkmoon13mo ago
No description
Nekro Darkmoon
Nekro Darkmoon13mo ago
@mleahy the former is embeddedName the latter is from this.#name
TyphonJS (Michael)
Well.... Here we go.. Some well thought out changes \s. ;P Turns out that it's the collection name. So instead of createItem or create.Item it's create.items... Oy vey!
Nekro Darkmoon
Nekro Darkmoon13mo ago
😄
TyphonJS (Michael)
Just a much larger headache and makes it harder to have compatibility across v10 / v11. Possible, but significantly more messy; about Foundry standard.. ;P
Nekro Darkmoon
Nekro Darkmoon13mo ago
I wonder if its create.effects instead of create.activeEffects yup it is
TyphonJS (Michael)
Yeah.. It will be whatever the collection name is and not the document name anymore. However, I'm thinking I can just put into the #embeddedNames the document name and then lookup the associated collection for the document and also put in create.<collection name>. So hopefully not as crazy of a change; just an annoyance.
Nekro Darkmoon
Nekro Darkmoon13mo ago
yeah
TyphonJS (Michael)
Thankfully the embedded object in has key / value for the collection name.
No description
Nekro Darkmoon
Nekro Darkmoon13mo ago
very nice!!
TyphonJS (Michael)
OK... I have what I think is a working patch that keeps v10 compatibility. I have attached a full replacement for EmbededStoreManager that you can drop into the TRL _dist/svelte/store/index.js bundle. IE just copy / paste the whole class attached here and let me know if it works. I need to go test the v10 compatibility aspects before pushing things out.
Nekro Darkmoon
Nekro Darkmoon13mo ago
👍
Nekro Darkmoon
Nekro Darkmoon13mo ago
@mleahy that works 👌
TyphonJS (Michael)
Excellent. A bit of a minor annoyance. Just doing final v10 compat testing and then I'll push things out. Anything else by chance that you have seen not working? I'm not aware of anything else at least and don't see a problem with anything in essential-svelte-esm. This is definitely an out of cadence release that is a bit awkward since I'll be checking out the v0.22 TRL version / building it / then manually replacing that code before pushing the release.
Nekro Darkmoon
Nekro Darkmoon13mo ago
I've been testing on v11 quite a bit and haven't noticed anything else
TyphonJS (Michael)
All good... Perhaps give TRL 0.0.23 a spin. As noted in the release notes it's a hot patch just for reactive embedded collections.
Nekro Darkmoon
Nekro Darkmoon13mo ago
will do 😄 We've already finished updating our system for v11. Was a bit of work since there were a bunch of good changes for active effects but yeah this should allow us to release our system for v11 tyvm for the quick update ❤️
Want results from more Discord servers?
Add your server
More Posts
Copying existing FQL to a new worldHello! I am running a world with Forien's Quest Log set up in a world, and I updated Foundry from v8How can I create an embeddedCollection in a chat message?I have this: ```javascript const messageDocument = game.messages.get(message._id); const doc = new THooks in svelte component? (not really a typhon question but nowhere else to ask :)In my foundry index.js I'm listening for hook: ```javascript Hooks.on('renderChatMessage', doSomethiActor update error, TRL/Svelte Token interaction?Ran into a bug I think, not sure if this is with Foundry or TRL. Related to the duplicate actor sheeDebugging TJSMenu for Auto Animations on Level Up - 5eJust a forum thread to discuss and explore an interesting phenomenon w/ TJSMenu not responding on thZ-index on TJSDialogsFor some reason TJSDialogs have an insane z-index value which makes them always appear on top of othRequest for Comment: Have any quality of life change suggestions for the quest log for v11?Greets, @FVTT ▹ Quest Log users! I am currently planning small modifications and quality of life cQuestion: Modifying class list of SvelteApplicationA question from @dorako: > so, my module hooks into renderApplication and modifies the html[0].classBlur on moving elementsAfter a few months of being gone, this started showing up for me again. Not sure why. It seems thatQuest Log: Is there a way to arrange quests within folders or collapsible quest lines?Hi @Arkangel. Apologies it took me a bit to get around to addressing your question. This is a two pa