so i was working on a 3D Vector calculation library, and i wanted a 3d morph to represent the pitch and yaw of the xyz vector, so i used the 3d beetle library. I didn’t want to load the beetle library with the vector library, so i figured i could load it using extension[src_load(url) V][libraries/beetle/beetle.js]@delInput@verticalEllipsis@addInput
i finished the project, and saved it to cloud. next morning, i see this: Load Failed: TypeError: Cannot read properties of undefined (reading 'fixLayout') when trying to load the project. and the only backup i have of the project (using the Recover button) is comepletely blank :(
it’s weird because i created failsafes for when the beetle library isnt loaded and when the js extensions settings are disabled.
i had created a variable and set it to a 3d vector to test it, so maybe that could be the problem?
here’s what the block looks like set [vec V] to (vector x: (0) y: (0) z: (0) :: #3cc66f)
and this is the closest representation of what the morph i made looked like (i took inspiration from a penguinmod extension)
Edited primitives are a usual source of such problems.
Post your project link and/or XML.
People here, sometimes, can recover a project by editing XML.
You can intercept the project load (XML) by the browser debugger.
turns out the variable i made was sabotaging me after all!
(i marked @dardoro’s post as the solution, but i appreciate your help too :)
but now there’s the issue of getting the beetle library using src_load.
i made a copy of the project, deleted the beetle category, reloaded the project copy, and now loading the morph for the vec3 type is really laggy, which was probably the reason the project wouldnt load.
edit: turns out the lag stopped, and it works!
edit2: weird… the project only lags if javascript extensions is enabled before loading the project…
edit3: i figured it out. the lag has nothing to do with js extensions. opening the project once is fine, but opening it again (without refreshing the page) is what causes this bug.
I guess you beat me, @theaysnap! I had tackled a similar problem before, but this one was tougher and took me longer. Just as I narrowed down the culprit (which is a variable out of anything) and was going to simplify the solution before releasing, you found it out yourself! Kudos!
Original reply
Someone has had a similar issue before with another project, and I am the one who helped solve it. But your project... is tougher for me to solve.
I tried doing these steps but that didn't work, because this no longer works in Snap! 12, sadly. However, I went back in time to Snap! v11 first (Snap! Build Your Own Blocks) after deleting custom block definitions. After that, I saved the project. I was going to load the original, but there wasn't an %adt slot back then so it errored. I cannot go to Snap! 12 or there will be the same errors.
I went back and modified the original, replacing all %adt with %s (Any type) slots. I loaded the project, but I was still in Snap! 11. I shift-clicked on the settings menu and selected "Primitives palette". However, that didn't do anything.
Unfortunately, that didn't work. I had no choice so I started deleting random custom blocks out of the project. After a few minutes of deleting random things, I deleted the watcher and it finally loaded in Snap! 12! I thought it was a glitched block, but the culprit turned out to be a variable out of anything.
did some tests, turns out src_load has nothing to do with this. reloading the project doesn’t remove the beetle functions, but instead makes them do nothing. bb_beetleView() returns null, and lags when passed through cst_morph.
tried replacing if<not(extension[snap_extensionexists(prim) V][bb_ready]@delInput@verticalEllipsis@addInput)>{
extension[src_load(url) V][libraries/beetle/beetle.js]@delInput@verticalEllipsis@addInput
with
extension[src_load(url) V][libraries/beetle/beetle.js]@delInput@verticalEllipsis@addInput and that didnt work
retries every JS function until it returns not null.
Loading a library the way it’s intended should do the trick ;)
If you insist on loading the extension the obscure way, you may test if bb_ready returns after a finite delay.
the problem is, loading a project with the beetle library loaded, then opening a new project will keep the beetle primitives, but they act like empty functions. loading it with src_load doesn’t work.
There is really a minor misfeature.
If you load projects one after another, even with properly loaded B3D, you must press Open 3D Window to initialize all components.