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
👌
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
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
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
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
still the same 🤔 it does get triggered properly though now
Nekro Darkmoon
it's tripping here now
Nekro Darkmoon
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
thanks a bunch ❤️
Nekro Darkmoon
@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
😄
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
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
yeah
TyphonJS (Michael)
Thankfully the embedded object in has key / value for the collection name.
No description
Nekro Darkmoon
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 Darkmoon
@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
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
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