T

TyphonJS

typhonjs-runtime

Join Server

v11 Debug embedded collection changes

MMLeahy5/25/2023
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.
NDNekro Darkmoon5/25/2023
👌
MMLeahy5/25/2023
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.
NDNekro Darkmoon5/25/2023
here's a link to our system working v11 branch
NDNekro Darkmoon5/25/2023
in case you need a system for testing
NDNekro Darkmoon5/25/2023
the regex is correct 🤔
NDNekro Darkmoon5/25/2023
I tested it manually and it works
MMLeahy5/25/2023
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);
         }
      }
   }
NDNekro Darkmoon5/25/2023
will this be out as an interm update or should I update the files manually
MMLeahy5/25/2023
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.
MMLeahy5/25/2023
The less code that needs to change for the interim patch the better.
MMLeahy5/25/2023
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.
NDNekro Darkmoon5/25/2023
I might have better luck testing with the package 🤣
NDNekro Darkmoon5/25/2023
vite caching is making a bit hard to change stuff and test locally 🙃
MMLeahy5/25/2023
You can delete .vite-cache
MMLeahy5/25/2023
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.
MMLeahy5/25/2023
Also just run production builds when testing this and not the dev server; just a head check here on that.
NDNekro Darkmoon5/25/2023
still the same 🤔
NDNekro Darkmoon5/25/2023
it does get triggered properly though now
NDNekro Darkmoon5/25/2023
NDNekro Darkmoon5/25/2023
it's tripping here now
NDNekro Darkmoon5/25/2023
NDNekro Darkmoon5/25/2023
here's an accompanying video
MMLeahy5/25/2023
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.
NDNekro Darkmoon5/25/2023
thanks a bunch ❤️
NDNekro Darkmoon5/25/2023
NDNekro Darkmoon5/25/2023
@TyphonJS (Michael) [UTC-7]
NDNekro Darkmoon5/25/2023
the former is embeddedName the latter is from this.#name
MMLeahy5/25/2023
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!
NDNekro Darkmoon5/25/2023
😄
MMLeahy5/25/2023
Just a much larger headache and makes it harder to have compatibility across v10 / v11. Possible, but significantly more messy; about Foundry standard.. ;P
NDNekro Darkmoon5/25/2023
I wonder if its create.effects instead of create.activeEffects
NDNekro Darkmoon5/25/2023
yup
NDNekro Darkmoon5/25/2023
it is
MMLeahy5/25/2023
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>.
MMLeahy5/25/2023
So hopefully not as crazy of a change; just an annoyance.
NDNekro Darkmoon5/25/2023
yeah
MMLeahy5/25/2023
Thankfully the embedded object in has key / value for the collection name.
NDNekro Darkmoon5/25/2023
very nice!!
MMLeahy5/25/2023
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.
NDNekro Darkmoon5/25/2023
👍
MMLeahy5/25/2023
NDNekro Darkmoon5/25/2023
@TyphonJS (Michael) [UTC-7] that works 👌
MMLeahy5/25/2023
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.
NDNekro Darkmoon5/25/2023
I've been testing on v11 quite a bit and haven't noticed anything else
MMLeahy5/25/2023
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.
NDNekro Darkmoon5/25/2023
will do 😄
NDNekro Darkmoon5/25/2023
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 ❤️