My project is permanently gone🥀

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)

i saved it to the cloud so i have no xml file to examine, this post is a last ditch effort to fix whatever happened

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.

That’s, an, IDEAAA!
I will pitch this to the main person to restore his project.

hey @theaysnap Edit your XML to restore your project. this will solve it, thanks! :slightly_smiling_face:

i’m have no idea how though :(
i’m not really experienced with the microsoft edge debugger, outside of the console

edit: i found what might be the xml file :)
https://file.garden/Zci1aehV2lX7DVXB/Untitled.xml

‍‍

oh.

clarification: i downloaded this to my computer and posted it on filegarden

I FIXED IT

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.

Corrupted project

(Pretend card engine is your project)

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.

i’m glad you made an attempt to help, and i appreciate it. thanks :)

okay, there’s a new problem

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

this is a continuation of this forum post i made.

loading a project that uses the beetle library, and then loading a new project keeps the beetle block extension functions, but they remain undefined.

this can cause issues like certain blocks returning null (Snap! can’t handle null values properly)

bumping this post because i need help with this

:snap: 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.

Modifying bb_ready() to not return null may break the flow of the whole library.

Or reload beetle.js once after starting project. Reload should work as expected.

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.

That isn’t a problem if you don’t use those leftover functions.

Beetle3D extension, based on library definition, loads a few libraries and calls an initialization script

Loading a random JS may not work as you expected.


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.