From f70b73676e1026846fd354dfefc14cdbb4c915af Mon Sep 17 00:00:00 2001 From: ALVAROPING1 Date: Tue, 14 Apr 2026 12:27:50 +0200 Subject: [PATCH] fix: fix loading of examples from URL params --- src/web/components/assembly/AssemblyActions.vue | 2 +- src/web/components/assembly/LibraryTags.vue | 2 +- src/web/components/assembly/LoadLibrary.vue | 16 +++++++--------- src/web/components/assembly/SaveLibrary.vue | 8 ++++---- src/web/components/assembly/TextareaAssembly.vue | 4 ++-- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/web/components/assembly/AssemblyActions.vue b/src/web/components/assembly/AssemblyActions.vue index bc4da5b98..0a0d9211b 100644 --- a/src/web/components/assembly/AssemblyActions.vue +++ b/src/web/components/assembly/AssemblyActions.vue @@ -130,7 +130,7 @@ const usesCreatorAssembler = computed(() => { }); const showLibraryButton = computed(() => { - return ((usesCreatorAssembler.value && libraryLoaded.value) || architecture.config.name.includes("SRV")); + return ((usesCreatorAssembler.value && libraryLoaded.value) || architecture?.config?.name?.includes("SRV")); }); // Watch for architecture changes diff --git a/src/web/components/assembly/LibraryTags.vue b/src/web/components/assembly/LibraryTags.vue index f13086e7e..d031bfdd9 100644 --- a/src/web/components/assembly/LibraryTags.vue +++ b/src/web/components/assembly/LibraryTags.vue @@ -38,7 +38,7 @@ export default { computed: { libraryLoaded() { // Access libraryVersion to make this reactive to library changes - if (architecture.config.name.includes("SRV")) + if (architecture?.config?.name?.includes("SRV")) return ( this.libraryVersion >= 0 && loadedLibrary && (libtags32.length !== 0 || libtags64.length !== 0) && diff --git a/src/web/components/assembly/LoadLibrary.vue b/src/web/components/assembly/LoadLibrary.vue index fb508ad1d..14009d39c 100644 --- a/src/web/components/assembly/LoadLibrary.vue +++ b/src/web/components/assembly/LoadLibrary.vue @@ -27,21 +27,21 @@ export default defineComponent({ }, data() { - return { + return { library: null, - compiler: architecture.config.name - }; + compiler: architecture?.config?.name, + }; }, computed: { file_accept() { - return (this.compiler.includes("SRV") ? ".o" : ".yml"); - } + return this.compiler?.includes("SRV") ? ".o" : ".yml"; + }, }, methods: { load() { // read file - if (!this.compiler.includes("SRV")) { + if (!this.compiler?.includes("SRV")) { show_loading(); const reader = new FileReader(); reader.onload = _event => { @@ -61,7 +61,7 @@ export default defineComponent({ } else { show_loading(); const reader = new FileReader(); - var arrayBuffer; + let arrayBuffer; reader.onload = _event => { try { load_library_sail(new Uint8Array(reader.result), document.getElementById("binary_file").files[0].name); @@ -70,8 +70,6 @@ export default defineComponent({ } }; reader.readAsArrayBuffer(this.library!); - - } }, }, diff --git a/src/web/components/assembly/SaveLibrary.vue b/src/web/components/assembly/SaveLibrary.vue index 2441418c5..29010c448 100644 --- a/src/web/components/assembly/SaveLibrary.vue +++ b/src/web/components/assembly/SaveLibrary.vue @@ -54,7 +54,7 @@ export default defineComponent({ } >, - compiler: architecture.config.name, + compiler: architecture?.config?.name, /*Binary data*/ binaryHex: "", @@ -202,7 +202,7 @@ export default defineComponent({ */ async handleShown() { // Compile as library - if (!this.compiler.includes("SRV")){ + if (!this.compiler?.includes("SRV")){ const compiled = await this.compileAsLibrary(); if (!compiled) { // Close modal if compilation failed @@ -230,7 +230,7 @@ export default defineComponent({ */ handleOk(evt: any) { evt.preventDefault(); - if (this.compiler.includes("SRV")) + if (this.compiler?.includes("SRV")) this.library_save_sail(); else this.library_save(); @@ -464,7 +464,7 @@ export default defineComponent({ title="File name" /> File will be saved as {{ name_binary_save || "library" }} {{ (compiler.includes("SRV")) ? ".o" : ".yml" }}File will be saved as {{ name_binary_save || "library" }} {{ (compiler?.includes("SRV")) ? ".o" : ".yml" }}
diff --git a/src/web/components/assembly/TextareaAssembly.vue b/src/web/components/assembly/TextareaAssembly.vue index 1e571aff9..4fa5bd0c3 100644 --- a/src/web/components/assembly/TextareaAssembly.vue +++ b/src/web/components/assembly/TextareaAssembly.vue @@ -504,7 +504,7 @@ watch(